2.0.23 • Published 3 years ago

jest-runner-tslint v2.0.23

Weekly downloads
618
License
MIT
Repository
github
Last release
3 years ago

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

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"]
2.0.23

3 years ago

2.0.22

3 years ago

2.0.20

3 years ago

2.0.21

3 years ago

2.0.19

3 years ago

2.0.18

3 years ago

2.0.17

3 years ago

2.0.16

3 years ago

2.0.15

3 years ago

2.0.14

3 years ago

2.0.13

3 years ago

2.0.12

3 years ago

2.0.11

3 years ago

2.0.10

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.3

4 years ago

2.0.4

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago