-
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.
Co-Authored-By: Colin Ihrig <cjihrig@gmail.com>
- Loading branch information
1 parent
f202322
commit 61be2da
Showing
5 changed files
with
185 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'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); | ||
}); | ||
}); |
59 changes: 59 additions & 0 deletions
59
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,59 @@ | ||
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' | ||
... | ||
1..5 | ||
# tests 7 | ||
# suites 0 | ||
# pass 4 | ||
# fail 3 | ||
# 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