-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f7c4e9
commit f20819b
Showing
11 changed files
with
121 additions
and
3 deletions.
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
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
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,16 @@ | ||
const test = require('node:test'); | ||
|
||
test('nested', (t) => { | ||
t.test('ok', () => {}); | ||
t.test('failing', () => { | ||
throw new Error('first'); | ||
}); | ||
}); | ||
|
||
test('top level', (t) => { | ||
t.test('ok', () => {}); | ||
t.test('failing', () => { | ||
throw new Error('second'); | ||
}); | ||
}); | ||
|
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,8 @@ | ||
const test = require('node:test'); | ||
|
||
test('multiple', (t) => { | ||
t.test('ok', () => {}); | ||
t.test('failing', () => { | ||
throw new Error('first'); | ||
}); | ||
}); |
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,37 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const fixtures = require('../common/fixtures'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const { describe, it } = require('node:test'); | ||
const { spawnSync } = require('node:child_process'); | ||
const assert = require('node:assert'); | ||
|
||
const testFile = fixtures.path('test-runner/bail/bail.js'); | ||
tmpdir.refresh(); | ||
|
||
describe('node:test bail', () => { | ||
it('should exit at first failure', async () => { | ||
const child = spawnSync(process.execPath, ['--test', '--test-bail=1', testFile]); | ||
console.log(child.stdout.toString()); | ||
assert.strictEqual(child.stderr.toString(), ''); | ||
assert.match(child.stdout.toString(), /TAP version 13/); | ||
assert.match(child.stdout.toString(), /ok 1 - ok/); | ||
assert.match(child.stdout.toString(), /not ok 2 - failing/); | ||
assert.match(child.stdout.toString(), /not ok 1 - nested/); | ||
assert.doesNotMatch(child.stdout.toString(), /not ok 2 - top level/); | ||
assert.doesNotMatch(child.stdout.toString(), /Subtest: top level/); | ||
}); | ||
|
||
it('should exit at second failure', async () => { | ||
const child = spawnSync(process.execPath, ['--test', '--test-bail=2', testFile]); | ||
console.log(child.stdout.toString()); | ||
assert.strictEqual(child.stderr.toString(), ''); | ||
assert.match(child.stdout.toString(), /TAP version 13/); | ||
assert.match(child.stdout.toString(), /ok 1 - ok/); | ||
assert.match(child.stdout.toString(), /not ok 2 - failing/); | ||
assert.match(child.stdout.toString(), /not ok 1 - nested/); | ||
assert.match(child.stdout.toString(), /not ok 2 - failing/); | ||
assert.match(child.stdout.toString(), /Subtest: top level/); | ||
}); | ||
}); |