Package Exports
- m.test
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (m.test) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
m.test
wip test runner from the m.icro series (~3kb).
install
install m.test directly from npm to project's devDependencies.
npm install --development m.testusage
test files are run by simply passing them to node. for a given test/index.js run the following to execute the suite:
node testcli
more utilities to run your suites are available through the cli. if no files are given they will be looked up from cwd 's test folder recursively.
m.test [options] [files]further instructions can be accessed via --help flag and man-pages by executing either m.test --help or man m.test within your shell.
sync usage
const {ok} = require('assert')
const {test} = require('m.test')
test('description', function () {
ok(true)
})async usage
test('description', function (done) {
setTimeout(function (done) {
done(null)
}, 0, done)
})recursive usage
const {test: describe, test: it} = require('m.test')
describe('context', function(){
it('works!', function (done) {
setTimeout(() => done(null), 0)
})
})beforeEach/afterEach usage
test('description', function (done) {
done(null)
})
beforeEach(done => setup(done))
afterEach(done => teardown(done))it is important to call beforeEach and afterEach hooks after test functions themselves. when using hooks within nested suites consider their contextual binding.
test('description 1', function () {
test('description 1.1', Function.prototype)
test('description 1.2', Function.prototype)
beforeEach(done => setup(done))
afterEach(done => teardown(done))
})
test('description 2', function () {
test('description 2.1', Function.prototype)
test('description 2.2', Function.prototype)
})(in the example above hooks would be called for 1.1 e 1.2)
skip usage
test.skip('description', function () {
// this function will never be called
})