mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
test_runner: fix todo inheritance
PR-URL: https://github.com/nodejs/node/pull/59721 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
parent
3903ee8cf3
commit
2258f22672
|
|
@ -647,7 +647,7 @@ class Test extends AsyncResource {
|
|||
this.expectedAssertions = plan;
|
||||
this.cancelled = false;
|
||||
this.skipped = skip !== undefined && skip !== false;
|
||||
this.isTodo = todo !== undefined && todo !== false;
|
||||
this.isTodo = (todo !== undefined && todo !== false) || this.parent?.isTodo;
|
||||
this.startTime = null;
|
||||
this.endTime = null;
|
||||
this.passed = false;
|
||||
|
|
|
|||
|
|
@ -146,20 +146,20 @@ ok 9 - no
|
|||
...
|
||||
# Subtest: no with todo
|
||||
# Subtest: yes
|
||||
ok 1 - yes
|
||||
ok 1 - yes # TODO
|
||||
---
|
||||
duration_ms: *
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: maybe
|
||||
# Subtest: yes
|
||||
ok 1 - yes
|
||||
ok 1 - yes # TODO
|
||||
---
|
||||
duration_ms: *
|
||||
type: 'test'
|
||||
...
|
||||
1..1
|
||||
ok 2 - maybe
|
||||
ok 2 - maybe # TODO
|
||||
---
|
||||
duration_ms: *
|
||||
type: 'suite'
|
||||
|
|
@ -193,9 +193,9 @@ ok 11 - DescribeForMatchWithAncestors
|
|||
1..11
|
||||
# tests 18
|
||||
# suites 12
|
||||
# pass 16
|
||||
# pass 14
|
||||
# fail 0
|
||||
# cancelled 0
|
||||
# skipped 2
|
||||
# todo 0
|
||||
# todo 2
|
||||
# duration_ms *
|
||||
|
|
|
|||
6
test/fixtures/test-runner/todo_exit_code.js
vendored
6
test/fixtures/test-runner/todo_exit_code.js
vendored
|
|
@ -13,3 +13,9 @@ test.todo('should fail without effecting exit code', () => {
|
|||
test('empty string todo', { todo: '' }, () => {
|
||||
throw new Error('Fail but not badly')
|
||||
});
|
||||
|
||||
describe.todo('should inherit todo', () => {
|
||||
test('should fail without harming suite', () => {
|
||||
throw new Error('Fail but not badly');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ if (process.argv[2] === 'child') {
|
|||
assert.strictEqual(child.status, 0);
|
||||
assert.strictEqual(child.signal, null);
|
||||
const stdout = child.stdout.toString();
|
||||
assert.match(stdout, /tests 3/);
|
||||
assert.match(stdout, /tests 4/);
|
||||
assert.match(stdout, /pass 0/);
|
||||
assert.match(stdout, /fail 0/);
|
||||
assert.match(stdout, /todo 3/);
|
||||
assert.match(stdout, /todo 4/);
|
||||
|
||||
child = spawnSync(process.execPath, [__filename, 'child', 'fail']);
|
||||
assert.strictEqual(child.status, 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user