| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -272,8 +272,8 @@ top level of the file's TAP output. | |||
| 272 | 272 | ||
| 273 | 273 | The second `setImmediate()` creates an `uncaughtException` event. | |
| 274 | 274 | `uncaughtException` and `unhandledRejection` events originating from a completed | |
| 275 | - test are handled by the `test` module and reported as diagnostic warnings in | ||
| 276 | - the top level of the file's TAP output. | ||
| 275 | + test are marked as failed by the `test` module and reported as diagnostic | ||
| 276 | + warnings in the top level of the file's TAP output. | ||
| 277 | 277 | ||
| 278 | 278 | ```js | |
| 279 | 279 | test('a test that creates asynchronous activity', (t) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,6 +46,7 @@ function createProcessEventHandler(eventName, rootTest) { | |||
| 46 | 46 | `triggered an ${eventName} event.`; | |
| 47 | 47 | ||
| 48 | 48 | rootTest.diagnostic(msg); | |
| 49 | + process.exitCode = kGenericUserError; | ||
| 49 | 50 | return; | |
| 50 | 51 | } | |
| 51 | 52 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ const { describe, it } = require('node:test'); | |||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | 11 | describe('ESM: REPL runs', { concurrency: true }, () => { | |
| 12 | - it((context, done) => { | ||
| 12 | + it((done) => { | ||
| 13 | 13 | const child = spawn(execPath, [ | |
| 14 | 14 | '--interactive', | |
| 15 | 15 | ], { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + import test from 'node:test'; | ||
| 2 | + | ||
| 3 | + test('extraneous async activity test', () => { | ||
| 4 | + setImmediate(() => { throw new Error(); }); | ||
| 5 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + import test from 'node:test'; | ||
| 2 | + | ||
| 3 | + test('extraneous async activity test', () => { | ||
| 4 | + setTimeout(() => { throw new Error(); }, 100); | ||
| 5 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + require('../common'); | ||
| 3 | + const fixtures = require('../common/fixtures'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const { spawnSync } = require('child_process'); | ||
| 6 | + | ||
| 7 | + { | ||
| 8 | + const child = spawnSync(process.execPath, [ | ||
| 9 | + '--test', | ||
| 10 | + fixtures.path('test-runner', 'extraneous_set_immediate_async.mjs'), | ||
| 11 | + ]); | ||
| 12 | + const stdout = child.stdout.toString(); | ||
| 13 | + assert.match(stdout, /^# pass 0$/m); | ||
| 14 | + assert.match(stdout, /^# fail 1$/m); | ||
| 15 | + assert.match(stdout, /^# cancelled 0$/m); | ||
| 16 | + assert.strictEqual(child.status, 1); | ||
| 17 | + assert.strictEqual(child.signal, null); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + { | ||
| 21 | + const child = spawnSync(process.execPath, [ | ||
| 22 | + '--test', | ||
| 23 | + fixtures.path('test-runner', 'extraneous_set_timeout_async.mjs'), | ||
| 24 | + ]); | ||
| 25 | + const stdout = child.stdout.toString(); | ||
| 26 | + assert.match(stdout, /^# pass 0$/m); | ||
| 27 | + assert.match(stdout, /^# fail 1$/m); | ||
| 28 | + assert.match(stdout, /^# cancelled 0$/m); | ||
| 29 | + assert.strictEqual(child.status, 1); | ||
| 30 | + assert.strictEqual(child.signal, null); | ||
| 31 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments