Splash config for default jest commands
To install this library, install it from npm as a development dependency by running the command below:
npm i --save-dev @splash-plus/jest-config
To run this module, import the module into a project using splash-scripts, and extend it from the extends field inside a splash config file:
// splash.config.js
{
extends: ['@splash-plus/jest-config'],
...
}
splash-scripts test
Runs all tests withing the current directory using the config defined in this package.
Note All commands support additional passed in arguments via simply appending them to the splash-scripts call: splash-scripts [command] [...options]
splash-scripts test:watch
Runs all tests withing the current directory using the config defined in this package in watch mode.
splash-scripts test:coverage
Runs all tests in code coverage mode.
This module also exports a seeded ChanceJS instance you can leverage in your tests by simply requiring it from this module:
import { chance } from '@splash-plus/jest-config';
chance.sentence();
This allows you to seed any randomness needed in tests to get consistent behavior in the event of a flaky test run. This module will log the current seed before jest runs any test, and in order to use a seed, provide it via an env to the script such as the below example:
export SEED=123456789
To get started, simply clone the repo and install node deps
npm install
In order to test this package locally for development purposes, it's best to clone this locally and either npm link this package or modify the package.json install path to point to your local instance in a package that can consume these modules.
Once the package path has been updated or linked, add an npm script to run the related command:
// package.json
{
...,
"scripts": {
"test": "splash-scripts test"
},
...
}
With that, simply run npm run test
and jest will run the related tests using a local version of the splash-scripts-jest-config pacakge.
Changes are automatically published upon merging to the master branch via semantic release
Commits utilize cz-conventional-changelog to force commit history to follow conventional commits.
Once files are staged, simply run git commit
and husky will automatically run verify before running conventional commits to assist in formatting semantic commits.
Using SemVer for versioning. For the versions available, see the release tags.
Licensed under MIT.