46
New test runner with ES6 module support! ?
source link: https://www.tuicool.com/articles/hit/NFfy2im
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.
Testicle
Test runner similar to tape, but with ES6 module support, simpler subtest syntax and nice indentation. Currently not TAP-compliant.
:cherries:
(please suggest better name )
Installation
npm i testicle
Usage
import t from 'testicle'; t('Testing things', (t) => { t('Test A', (t) => { t.plan(1); t.pass('Works!'); }); t('Test B', (t) => { t.plan(1); t.pass('Works!'); }); });
node --experimental-modules test.mjs Testing things Test A ✔︎ Works! » Passed 1/1 Test B ✔︎ Works! » Passed 1/1 ♥︎ All tests passed ♥︎
API
t(description, test)
Create a test
t.plan(count)
Define how many tests there will be.
t.pass(message)
Pass the test
t.fail(message)
Fail the test
t.equal(a, b, message)
t.equals(a, b, message)
Test if a and b are equal
t.deepEqual(a, b, message)
t.deepEquals(a, b, message)
Test if a and b are deeply equal
t(message, (t) => { t(description, test) })
Setup subtest
License
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK