Skip to content

Latest commit

 

History

History

sui-jest

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

sui-jest

This is a CLI that abstracts away all configuration for Jest.

Installation

npm install -D @s-ui/jest

Usage

This CLI exposes a bin called sui-jest with all options that Jest CLI Options supports.

From node

node ./node_modules/.bin/sui-jest [Jest CLI Options]

From npm script

// package.json
{
  "scripts": {
    "test:jest": "sui-jest"
  }
}
npm run test:jest -- [Jest CLI Options]

Overriding Config

sui-jest allows you to specify your own configuration. There are various ways that it works, but basically if you want to have your own config for something, just add the configuration and sui-jest will use it instead of its own internal config.

Specific

From CLI using the --config flag with the path of the specific jest config file.

node ./node_modules/.bin/sui-jest --config jest.config.[*]

Automatic

Create a jest.config.[*] config file in your root project or within the packages/*, and sui-jest will use the jest config file closest to where it has been executed.

// jest.config.js

module.exports = {
  testEnvironment: 'jsdom',
  testMatch: ['**/__tests__/**/*.test.js']
  // ...
}

In construction

In addition, sui-jest will expose its basic configuration so you can use it and override only the parts of the config you need to.

Inspiration

This is inspired by kcd-scripts.