Registry / testing / tslint-jest

tslint-jest

JSON →
library1.0.5jsnpmunverified

tslint-jest is a TSLint plugin providing lint rules for Jest test files. Version 1.0.5 is the latest stable release; the package is no longer actively maintained as TSLint is deprecated in favor of ESLint. It offers rules such as no-alias-methods and expect-expect. Unlike alternatives (eslint-plugin-jest), this plugin is specific to TSLint and is only useful for projects still using TSLint.

npm install tslint-jest
INSTALL
IMPORT
SIG · TSLINT-JEST
T
tslint-jest
testingjavascriptv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

no-alias-methods
{ "extends": ["tslint-jest"], "rules": { "no-alias-methods": true } }
import { no-alias-methods } from 'tslint-jest'
Rules are specified in tslint.json configuration, not imported in code.
expect-expect
{ "extends": ["tslint-jest"], "rules": { "expect-expect": true } }
const { expect-expect } = require('tslint-jest')
Configure rules in tslint.json, not via require/import.
tslint-jest configuration
{ "extends": ["tslint-jest"] }
require('tslint-jest')
The package is a TSLint ruleset; it is used by adding to 'extends' array in tslint.json, not by requiring in code.

Install tslint-jest, configure rules in tslint.json, and lint Jest test files.

// Step 1: Install yarn add --dev tslint-jest // Step 2: Configure tslint.json { "extends": ["tslint-jest"], "rules": { "no-alias-methods": true, "expect-expect": [true, { "assertFunctionNames": ["expect", "assert"] }] } } // Step 3: Run tslint on a test file npx tslint --project tsconfig.json 'src/**/*.test.ts'
Debug
Known issues
deprecatedTSLint is deprecated in favor of ESLint; tslint-jest is no longer maintained.
fix
Use eslint-plugin-jest with ESLint instead.
affects: >=1.0.0
gotchaRules are only available via tslint.json; you cannot import them programmatically in code.
fix
Always define rules in tslint.json configuration file.
affects: >=1.0.0
gotchaexpect-expect rule may flag tests with no explicit assertions inside `it` or `test` blocks even if they contain async calls that throw.
fix
Use the `assertFunctionNames` option to whitelist custom assertion functions.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'tslint-jest'
The package is not installed or not in node_modules.
fix
Run `npm install --save-dev tslint-jest`.
Invalid rules configuration: unknown rule 'no-alias-methods'
tslint-jest extension not added to tslint.json.
fix
Ensure `"extends": ["tslint-jest"]` is present in tslint.json.
TypeError: Cannot read property 'apply' of undefined (TSLint error)
Incompatible TSLint version or plugin not loaded.
fix
Stick to TSLint 5.x and tslint-jest 1.0.x.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
tslint-jest — npm install tslint-jest · libregistry