| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Minimum Viable Testing framework
Version 5.0.0+ deprecates support for CommonJS, opting to only support ES Modules.
Please use mvt@4 for CommonJS usage.
Because AVA is awesome. Security alerts on dev dependencies are not awesome. Especially when you use the same test library across dozens of projects. No matter how well maintained a project is, when it contains 300+ dependencies security alerts are going to occur.
But It's Just a Dev Dependency...
# Install globally
$ npm install --global mvt
# Install for project
$ npm install --save-dev mvtmvt
# OR
mvt test
# OR
mvt test.js test2.js
# OR
mvt --verbose
# OR
mvt test --verbose
# OR
node test.js --verbose
# etc...import test from 'mvt'
test.setup({ verbose: true })
test.after(() => console.log('test.after invoked'))
test.before(() => console.log('test.before invoked'))
test('assert.is works', (assert) => {
assert.is(1, 1)
})
test.failing('test.failing and assert.fail works', (assert) => {
assert.fail()
})
test.todo('test.todo works')
test.skip('test.skip works', (assert) => assert.truthy('skipped'))
test.only('test.only works', (assert) => assert.truthy('only'))
test.bench('test.bench works', (assert) => {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(), 200)
})
}, { samples: 5, max: 300 })The only thing this module exports.
Main function, give it a message and a test function. Test function receives the assert object (see below).
Use this to configure your tests.
Run this before we start running any tests. [callback can be async]
Run this after we run all tests. [callback can be async]
Tests will only be run on any tests run with this modifier.
Skip that test (logical enough).
This test must fail. If it passes, we'll fail your whole test suite. Goteem.
This is just a placeholder for your good intentions.
Run the testFunction opts.samples || 10 times. If average run duration is more than opts.max || 100 milliseconds fail the test.
Methods available on assert object passed to testFunction
If your test file is called with the --verbose flag it will list all passed tests
It fails fast and hard with process.exit(1)
If you have diff installed as a peer dependency, we'll use that for string diffs. To make them more readable and what not.
MIT © Andrew Carpenter
| Back | FazBrowse Home | New Git URL |