-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
test_runner: bail #48919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_runner: bail #48919
Changes from all commits
be12fbd
647fd4c
5668e01
d95b14f
5a043b4
faf412b
483afdb
f89902d
63f0b8d
aaedfac
92714ba
87e075a
fa97f5e
473eb53
6e13cbf
0ed5160
0074fa2
4291a2a
0d8ec96
e91c680
6e012a1
f9d1765
c508639
5b69804
6678a3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ const { | |
const { inspectWithNoCustomRetry } = require('internal/errors'); | ||
const { isError, kEmptyObject } = require('internal/util'); | ||
const { getCoverageReport } = require('internal/test_runner/utils'); | ||
const { kBailedOut } = require('internal/test_runner/test'); | ||
const kDefaultIndent = ' '; // 4 spaces | ||
const kFrameStartRegExp = /^ {4}at /; | ||
const kLineBreakRegExp = /\n|\r\n/; | ||
|
@@ -32,6 +33,8 @@ async function * tapReporter(source) { | |
for await (const { type, data } of source) { | ||
switch (type) { | ||
case 'test:fail': { | ||
// If test bailed out do not report | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so a test can run without us reporting it? I am not sure this is good There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test has error |
||
if (data.details?.error?.failureType === kBailedOut) break; | ||
yield reportTest(data.nesting, data.testNumber, 'not ok', data.name, data.skip, data.todo); | ||
const location = `${data.file}:${data.line}:${data.column}`; | ||
yield reportDetails(data.nesting, data.details, location); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
const common = require('../../../common'); | ||
const test = require('node:test'); | ||
marco-ippolito marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
test('nested', (t) => { | ||
t.test('first', () => {}); | ||
t.test('second', () => { | ||
throw new Error(); | ||
}); | ||
t.test('third', common.mustNotCall(() => {})); | ||
}); | ||
|
||
test('top level', (t) => { | ||
t.test('forth', () => {}); | ||
t.test('fifth', () => { | ||
throw new Error(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
const common = require('../../../common'); | ||
marco-ippolito marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const assert = require('assert'); | ||
const test = require('node:test'); | ||
|
||
test('keep error', (t) => { | ||
assert.strictEqual(0, 1); | ||
}); | ||
|
||
test('dont show', common.mustNotCall((t) => { | ||
assert.strictEqual(0, 2); | ||
})); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Flags: --test-bail --test-reporter=tap | ||
'use strict'; | ||
const common = require('../../../common'); | ||
const assert = require('assert'); | ||
const test = require('node:test'); | ||
|
||
test('keep error', (t) => { | ||
assert.strictEqual(0, 1); | ||
}); | ||
|
||
test('dont show', common.mustNotCall((t) => { | ||
assert.strictEqual(0, 2); | ||
})); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
TAP version 13 | ||
not ok 1 - keep error | ||
--- | ||
duration_ms: * | ||
location: '/test/fixtures/test-runner/output/bail-error.js:(LINE):1' | ||
failureType: 'testCodeFailure' | ||
error: |- | ||
Expected values to be strictly equal: | ||
|
||
0 !== 1 | ||
|
||
code: 'ERR_ASSERTION' | ||
name: 'AssertionError' | ||
expected: 1 | ||
actual: 0 | ||
operator: 'strictEqual' | ||
stack: |- | ||
* | ||
* | ||
* | ||
* | ||
* | ||
... | ||
1..2 | ||
# tests 2 | ||
# suites 0 | ||
# pass 0 | ||
# fail 1 | ||
# cancelled 1 | ||
# skipped 0 | ||
# todo 0 | ||
# duration_ms * |
Uh oh!
There was an error while loading. Please reload this page.