Super opinionated test library using Mocha, Babel, Chai, Sinon, sinon-chai, proxyquire and IstanbulJS.
Version 0.7.0, released on 2022-11-11, is the last version of the project, as the experiment showed that the whole approach to building this test library was quite flawed. It became apparent especially when I tried to make it work with native ESM.
Personally I'm recommending ava
and if I were going to write a test library again, I would definitely take inspiration from it.
npm install @comandeer/mocha-lib-tester --save-dev
Just make it a npm script:
"scripts": {
"test": "mlt"
}
You can also run only selected steps, e.g.
mlt test coverage
The above command will run only Mocha tests and display code coverage info.
Id | Name | Description |
---|---|---|
lint | Linter | Runs ESLint against the code. |
test | Tester | Runs tests against the code. |
coverage | Code Coverage | Gathers and displays info about code coverage. |
codecov | CodeCov | Uploads info about code coverage to CodeCov. |
The command also allows to run tests in a watch mode, which reruns tests every time any file changes in your project's src/
and tests/
directories. To use the watch mode just add --watch
argument:
mlt --watch
You can also watch only selected steps, e.g.
mlt test --watch
No configuration. Consider it a feature.
For now to enable Intellisense for tests, you need to add jsconfig.json
file to your project:
{
"compilerOptions": {
"typeRoots": [
"./node_modules/@types",
"./node_modules/@comandeer"
]
}
}
See LICENSE file for details.