-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from nichoth/test-end
- Loading branch information
Showing
14 changed files
with
154 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const test = require('../../../index').test | ||
|
||
test('Plan the correct number of tests', t => { | ||
t.plan(2) | ||
t.ok('example') | ||
t.ok('example') | ||
}) | ||
|
||
test('.plan with an async function', async t => { | ||
t.plan(2) | ||
await sleep(10) | ||
t.ok('hello') | ||
await sleep(20) | ||
t.ok('hello') | ||
}) | ||
|
||
/** | ||
* Wait for a number of miliseconds. | ||
* @param {number} ms | ||
*/ | ||
async function sleep (ms) { | ||
await new Promise((resolve) => { | ||
setTimeout(resolve, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const test = require('../../../index').test | ||
|
||
test('Plan an incorrect number of tests', t => { | ||
t.plan(1) | ||
t.ok('example') | ||
t.ok('example') | ||
}) |
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 @@ | ||
TAP version 13 | ||
# Plan an incorrect number of tests | ||
ok 1 should be truthy | ||
$TAPE/index.js:$LINE | ||
function rethrow () { throw err } | ||
^ | ||
|
||
Error: More tests than planned in TEST *Plan an incorrect number of tests* | ||
at Test._assert ($TAPE/index.js:$LINE:$COL) | ||
at Test.ok ($TAPE/index.js:$LINE:$COL) | ||
at Test.fn ($TEST/zora/fixtures/plan_fail.js:$LINE:$COL) | ||
at Test.run ($TAPE/index.js:$LINE:$COL) | ||
at TestRunner.run ($TAPE/index.js:$LINE:$COL) | ||
at Timeout._onTimeout ($TAPE/index.js:$LINE:$COL) | ||
at listOnTimeout (node:internal/timers:$LINE:$COL) | ||
at process.processTimers (node:internal/timers:$LINE:$COL) |
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,7 @@ | ||
const test = require('../../../index').test | ||
|
||
test('Execute fewer tests than planned', t => { | ||
t.plan(3) | ||
t.ok('example') | ||
t.ok('example 2') | ||
}) |
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,17 @@ | ||
TAP version 13 | ||
# Execute fewer tests than planned | ||
ok 1 should be truthy | ||
ok 2 should be truthy | ||
$TAPE/index.js:$LINE | ||
function rethrow () { throw err } | ||
^ | ||
|
||
Error: Test ended before the planned number | ||
planned: 3 | ||
actual: 2 | ||
|
||
at Test.run ($TAPE/index.js:$LINE:$COL) | ||
at TestRunner.run ($TAPE/index.js:$LINE:$COL) | ||
at Timeout._onTimeout ($TAPE/index.js:$LINE:$COL) | ||
at listOnTimeout (node:internal/timers:$LINE:$COL) | ||
at process.processTimers (node:internal/timers:$LINE:$COL) |
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,13 @@ | ||
TAP version 13 | ||
# Plan the correct number of tests | ||
ok 1 should be truthy | ||
ok 2 should be truthy | ||
# .plan with an async function | ||
ok 3 should be truthy | ||
ok 4 should be truthy | ||
|
||
1..4 | ||
# tests 4 | ||
# pass 4 | ||
|
||
# ok |
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