Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Comandeer/mocha-lib-tester

Repository files navigation

@comandeer/mocha-lib-tester

Build Status codecov npm (scoped)

Super opinionated test library using Mocha, Babel, Chai, Sinon, sinon-chai, proxyquire and IstanbulJS.

☠️ Project is deprecated! ☠️

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.

How does it work?

Installation

npm install @comandeer/mocha-lib-tester --save-dev

Usage

Just make it a npm script:

"scripts": {
	"test": "mlt"
}

Run only selected steps

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.

Available steps

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.

Watch mode

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

Configuration

No configuration. Consider it a feature.

Enabling Intellisense

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"
		]
	}
}

License

See LICENSE file for details.

About

All testing utilities in one, small package

Resources

License

Stars

Watchers

Forks

Packages

No packages published