m.test
m(icro)test is a lightweight test runner for node.js written in es6+ (~4kb).
donations
thanks for your support! gratipay
install
install m.test directly from npm to project's devDependencies.
npm install --save-dev m.test
usage
test files are run by simply passing them to node. for a given test/index.js
run the following command to execute the suite:
node test
run the following one to enable node's debugger:
node debug test
cli
more utilities to run your suites are available through the cli. if no files are given they will be looked up from ./test
recursively.
m.test [options] [files]
when executing suites through the cli m.test
will be assigned to global.test
by design. the following line can be omitted:
const test =
further instructions can be accessed via --help
flag and man-pages by executing either m.test --help
or man m.test
within your shell.
basic usage
const ok =
async usage
const ok =
context usage
alias usage
const test: context test: describe test: it =
beforeEach afterEach usage
it is important to call beforeEach
and afterEach
wrap functions after test
functions themselves. when using wraps within nested suites consider their contextual binding.
(in the example above hooks would be called for 1.1
e 1.2
)
skip modifier
test
the skip modifier comes with an optional doSkip=true
parameter that enables/disables the skip behavior according to the expression:
test
timeout modifier
test
the timeout modifier comes with an optional doTimeout=true
parameter that enables/disables the timeout behavior according to the expression:
test