-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Colin Ihrig <cjihrig@gmail.com>
- Loading branch information
1 parent
f202322
commit 8bd4c30
Showing
6 changed files
with
242 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
const { test } = require('node:test'); | ||
|
||
test('test planning basic', (t) => { | ||
t.plan(2); | ||
t.assert.ok(true); | ||
t.assert.ok(true); | ||
}); | ||
|
||
test('less assertions than planned', (t) => { | ||
t.plan(1); | ||
}); | ||
|
||
test('more assertions than planned', (t) => { | ||
t.plan(1); | ||
t.assert.ok(true); | ||
t.assert.ok(true); | ||
}); | ||
|
||
test('subtesting correctly', (t) => { | ||
t.plan(1); | ||
t.assert.ok(true); | ||
t.test('subtest', (st) => { | ||
st.plan(1); | ||
st.assert.ok(true); | ||
}); | ||
}); | ||
|
||
test('correctly ignoring subtesting plan', (t) => { | ||
t.plan(1); | ||
t.test('subtest', (st) => { | ||
st.plan(1); | ||
st.assert.ok(true); | ||
}); | ||
}); | ||
|
||
test('failing planning by options', { plan: 1 }, () => { | ||
}); | ||
|
||
test('not failing planning by options', { plan: 1 }, (t) => { | ||
t.assert.ok(true); | ||
}); | ||
|
||
test('subtest planning by options', (t) => { | ||
t.test('subtest', { plan: 1 }, (st) => { | ||
st.assert.ok(true); | ||
}); | ||
}); | ||
|
84 changes: 84 additions & 0 deletions
84
test/fixtures/test-runner/output/test-runner-plan.snapshot
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,84 @@ | ||
TAP version 13 | ||
# Subtest: test planning basic | ||
ok 1 - test planning basic | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: less assertions than planned | ||
not ok 2 - less assertions than planned | ||
--- | ||
duration_ms: * | ||
location: '/test/fixtures/test-runner/output/test-runner-plan.js:(LINE):1' | ||
failureType: 'testCodeFailure' | ||
error: 'plan expected 1 assertions but received 0' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
# Subtest: more assertions than planned | ||
not ok 3 - more assertions than planned | ||
--- | ||
duration_ms: * | ||
location: '/test/fixtures/test-runner/output/test-runner-plan.js:(LINE):1' | ||
failureType: 'testCodeFailure' | ||
error: 'plan expected 1 assertions but received 2' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
# Subtest: subtesting correctly | ||
# Subtest: subtest | ||
ok 1 - subtest | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 4 - subtesting correctly | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: correctly ignoring subtesting plan | ||
# Subtest: subtest | ||
ok 1 - subtest | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
not ok 5 - correctly ignoring subtesting plan | ||
--- | ||
duration_ms: * | ||
location: '/test/fixtures/test-runner/output/test-runner-plan.js:(LINE):1' | ||
failureType: 'testCodeFailure' | ||
error: 'plan expected 1 assertions but received 0' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
# Subtest: failing planning by options | ||
not ok 6 - failing planning by options | ||
--- | ||
duration_ms: * | ||
location: '/test/fixtures/test-runner/output/test-runner-plan.js:(LINE):1' | ||
failureType: 'testCodeFailure' | ||
error: 'plan expected 1 assertions but received 0' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
# Subtest: not failing planning by options | ||
ok 7 - not failing planning by options | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: subtest planning by options | ||
# Subtest: subtest | ||
ok 1 - subtest | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 8 - subtest planning by options | ||
--- | ||
duration_ms: * | ||
... | ||
1..8 | ||
# tests 11 | ||
# suites 0 | ||
# pass 7 | ||
# fail 4 | ||
# cancelled 0 | ||
# skipped 0 | ||
# todo 0 | ||
# duration_ms * |
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