forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: extraneous async activity make a failure
Fixes: nodejs#44612
- Loading branch information
1 parent
a14fc49
commit 01170fa
Showing
5 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import test from 'node:test'; | ||
|
||
test('extraneous async activity test', () => { | ||
setImmediate(() => { throw new Error(); }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import test from 'node:test'; | ||
|
||
test('extraneous async activity test', () => { | ||
setTimeout(() => { throw new Error(); }, 100); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
const fixtures = require('../common/fixtures'); | ||
const assert = require('assert'); | ||
const { spawnSync } = require('child_process'); | ||
|
||
{ | ||
const child = spawnSync(process.execPath, ['--test', fixtures.path('test-runner', 'extraneous_set_immediate_async.mjs')]); | ||
const stdout = child.stdout.toString(); | ||
assert.match(stdout, /^# pass 0$/m); | ||
assert.match(stdout, /^# fail 1$/m); | ||
assert.match(stdout, /^# cancelled 0$/m); | ||
assert.strictEqual(child.status, 1); | ||
assert.strictEqual(child.signal, null); | ||
} | ||
|
||
{ | ||
const child = spawnSync(process.execPath, ['--test', fixtures.path('test-runner', 'extraneous_set_timeout_async.mjs')]); | ||
const stdout = child.stdout.toString(); | ||
assert.match(stdout, /^# pass 0$/m); | ||
assert.match(stdout, /^# fail 1$/m); | ||
assert.match(stdout, /^# cancelled 0$/m); | ||
assert.strictEqual(child.status, 1); | ||
assert.strictEqual(child.signal, null); | ||
} |