9
GitHub - markwylde/assert-plan: The node assert library but with a plan method t...
source link: https://github.com/markwylde/assert-plan
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
assert-plan
The node assert library but with a plan method to check a certain amount of assertions are raised.
Installation
npm install --save-dev assert-plan
Example Usage
import test from 'node:test';
import assertPlan from 'assert-plan';
test('test 1 assertion', async t => {
const assert = assertPlan(1);
assert.strictEqual(1, 1);
await assert.wait();
});
test('test 2 assertions will hang indefinitely', async t => {
const assert = assertPlan(2);
assert.strictEqual(1, 1);
await assert.wait();
});
test('test 2 assertions will timeout', async t => {
const assert = assertPlan(2, { timeout: 2000 });
assert.strictEqual(1, 1);
await assert.wait();
});
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK