Skip to content

jest-runner-tslint

Build Status npm version codecov

Usage

Install

Install jest(it needs Jest 21+) and jest-runner-tslint

yarn add --dev jest jest-runner-tslint

# or with NPM

npm install --save-dev jest jest-runner-tslint

Add it to your Jest config

In your package.json

{
  "jest": {
    "runner": "jest-runner-tslint",
    "moduleFileExtensions": ["ts"],
    "testMatch": ["**/*.ts"]
  }
}

Or in jest.config.js

module.exports = {
  runner: "jest-runner-tslint",
  moduleFileExtensions: ["ts"],
  testMatch: ["**/*.ts"]
};

Run Jest

yarn jest

Options

This project uses cosmiconfig, so you can provide config via:

  • a jest-runner-tslint property in your package.json
  • a jest-runner-tslint.config.js JS file
  • a .jest-runner-tslintrc JSON file

In package.json

{
  "jest-runner-tslint": {
    "cliOptions": {
      // Options here
    }
  }
}

or in jest-runner-tslint.config.js

module.exports = {
  cliOptions: {
    // Options here
  }
};

cliOptions

jest-runner-tslint maps a lot of ESLint CLI arguments to config options. For example --fix is cliOptions.fix

optiondefaultexample
fixfalse"fix": true
formatter"stylish""formatter": "tap"
formattersDirectorynull"formattersDirectory": "node_modules/custom-tslint-formatters/formatters"
rulesDirectorynull"rulesDirectory": "path/to/rules" or "rulesDirectory": ["path/to/rules", "path/to/other"]