2.0.3 • Published 4 years ago

@splash-plus/jest-config v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

-----------------------------------------------------

@splash-plus/jest-config

CircleCI

-----------------------------------------------------

Table of Contents

-----------------------------------------------------

Installing

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

-----------------------------------------------------

Usage

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'],
  ...
}

API

test

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]

test:watch

splash-scripts test:watch

Runs all tests withing the current directory using the config defined in this package in watch mode.

test:coverage

splash-scripts test:coverage

Runs all tests in code coverage mode.

Chance Instance

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

-----------------------------------------------------

Developing

Built With

Prerequisites

To get started, simply clone the repo and install node deps

npm install

Building

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.

Setting up Dev

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.

Deploying / Publishing

Changes are automatically published upon merging to the master branch via semantic release

Commiting

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.

-----------------------------------------------------

Versioning

Using SemVer for versioning. For the versions available, see the release tags.

-----------------------------------------------------

Licensing

Licensed under MIT.