Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

jest-runner-tslint

2.0.0 • Public • Published

jest-runner-tslint

Deprecated

Due to the deprecation of TSLint this package is as well in the process of being deprecation. Before this happens officially, this package is following a similar path of maintenance before final deprecation.

In the meantime, if you are currently using this package, please take the time to transition your project to ESLint, typescript-eslint, and jest-runner-eslint.

For more information on the industry-wide transition from TSLint to ESLint, please see the following:

Usage

Install

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

yarn add --dev tslint jest jest-runner-tslint
 
# or with NPM 
 
npm install --save-dev tslint jest jest-runner-tslint
 

Add it to your Jest config

Using Built-in Preset

This package includes a Jest preset which configures Jest to run TSLint on all files supported by TSLint. To use it set the following in your package.json:

{
  "jest": {
    "preset": "jest-runner-tslint"
  }
}

or jest.config.js:

module.exports = {
  preset: "jest-runner-tslint"
};

Manually

In your package.json

{
  "jest": {
    "moduleFileExtensions": ["ts", "tsx", "js", "jsx"],
    "runner": "tslint",
    "testMatch": ["**/*.ts", "**/*.tsx", "**/*.d.ts", "**/*.js", "**/*.jsx"]
  }
}

Or in jest.config.js

module.exports = {
  moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
  runner: "tslint",
  testMatch: ["**/*.ts", "**/*.tsx", "**/*.d.ts", "**/*.js", "**/*.jsx"]
};

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

option default example
fix false "fix": true
formatter "stylish" "formatter": "tap"
formattersDirectory null "formattersDirectory": "node_modules/custom-tslint-formatters/formatters"
rulesDirectory null "rulesDirectory": "path/to/rules" or "rulesDirectory": ["path/to/rules", "path/to/other"]

Keywords

none

Install

npm i jest-runner-tslint

DownloadsWeekly Downloads

1,100

Version

2.0.0

License

MIT

Unpacked Size

5.89 kB

Total Files

2

Last publish

Collaborators

  • avatar