tslint-plugin-jasmine

TSLint rules for Jasmine

Usage no npm install needed!

<script type="module">
  import tslintPluginJasmine from 'https://cdn.skypack.dev/tslint-plugin-jasmine';
</script>

README

npm version Build Status semantic-release

tslint-plugin-jasmine

TSLint rules for Jasmine

Usage

  1. Install tslint-plugin-jasmine as a dev dependency:

    npm install --save-dev tslint-plugin-jasmine
    
  2. Enable the rules by adding it to your tslint.json:

{
  "extends": [
    // ...other rules
    "tslint-plugin-jasmine"
  ],
  "rules": {
    // enable/disable rules
  }
}

Rules

No rules are enabled by default. You can use the recommended configuration:

Rule Recommended Options
expect-matcher { "severity": "warning" }
expect-single-argument { "severity": "warning" }
missing-expect { "severity": "off", "options": ["expect()", "expectAsync()"] } expectation function names
named-spy { "severity": "off" }
new-line-before-expect { "severity": "warning" }
new-line-between-declarations { "severity": "warning" }
no-assign-spyon { "severity": "off" }
no-describe-variables { "severity": "off" }
no-disabled-tests { "severity": "warning" }
no-expect-in-setup-teardown { "severity": "warning", "options" ["expect()", "expectAsync()"] } expectation function names
no-focused-tests { "severity": "error" }
no-global-setup { "severity": "error" }
no-promise-without-done-fail { "severity": "warning" }
no-spec-dupes { "severity": "warning" } 'branch'
no-suite-callback-args { "severity": "error" }
no-suite-dupes { "severity": "warning" } 'branch'
no-unsafe-spy { "severity": "warning" }
prefer-jasmine-matcher { "severity": "warning" }
prefer-to-have-been-called-with { "severity": "warning" }

For example, using the recommended configuration, the no-focused-tests rule is enabled and will cause TSLint to throw an error (with an exit code of 1) when triggered.

License

Released under the MIT license.