GithubHelp home page GithubHelp logo

kaiza / tslint-jasmine-rules Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 12.0 57 KB

tslint rules for jasmine tests

License: MIT License

TypeScript 100.00%
tslint-rules jasmine-tests tslint-jasmine-rules tslint jasmine

tslint-jasmine-rules's Introduction

tslint-jasmine-rules

tslint rules for jasmine tests

Install

npm install tslint-jasmine-rules --save-dev

Then reference the rules in your tslint.json and enable the rules you want:

{
  "extends": [
    "tslint-jasmine-rules"
  ],
  "rules":{
  }
}

Available rules

{
  "no-focused-tests": true,
  "no-disabled-tests": true,
  "expect-length": true
}

Fixable

The following rules are fixable:

  • no-focused-tests
  • no-disabled-tests

Fixes are not applied when "severity": "warning" is used.

tslint-jasmine-rules's People

Contributors

aleclarson avatar bastienmoulia avatar blackbaud-stevebrush avatar ideadapt avatar jlin-clgx avatar kaiza avatar themattspiral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tslint-jasmine-rules's Issues

[Feature] Add an option to make the rules fixable

I would like to have an option to make the rules fixable when using tslint --fix.
The fix will be to remove the first letter (f or x) for describe and it.

{
  "no-focused-tests": [true, "fix"],
  "no-disabled-tests": [true, "fix"]
}

Auto-fix should not be enabled by default

Hi,

when we are using the tslint-jasmine-rules with an IDE like VSCode, that has auto-fixing for tslint issues enabled on save, we can no longer focus tests by adding an 'f' and save as the auto-fixing takes place before the following test run. The fixing should not be mandatory but optional as intended by #11.

Can't find 'no-jasmine-focus' after installing

I have done the following in my Angular 7 project:

npm install tslint-jasmine-rules --save-dev

I keep getting this error when running ng lint:

Could not find implementations for the following rules specified in the configuration:
    no-jasmine-focus
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.

Here's my tslint.json file:

{
  "extends": [
    "tslint:recommended",
    "tslint-config-prettier",
    "tslint-jasmine-rules"
  ],
  "rulesDirectory": ["codelyzer"],
  "rules": {
    "array-type": false,
    "arrow-parens": false,
    "deprecation": {
      "severity": "warn"
    },
    "import-blacklist": [true, "rxjs/Rx"],
    "interface-name": false,
    "max-classes-per-file": false,
    "member-access": false,
    "member-ordering": [
      true,
      {
        "order": [
          "static-field",
          "instance-field",
          "static-method",
          "instance-method"
        ]
      }
    ],
    "no-console": [
      true,
      "debug",
      "info",
      "time",
      "timeEnd",
      "trace"
    ],
    "no-inferrable-types": [
      true,
      "ignore-params"
    ],
    "no-var-keyword": true,
    "no-non-null-assertion": true,
    "no-redundant-jsdoc": true,
    "no-switch-case-fall-through": true,
    "no-use-before-declare": true,
    "no-var-requires": false,
    "object-literal-key-quotes": [true, "as-needed"],
    "object-literal-sort-keys": false,
    "ordered-imports": false,
    "no-output-on-prefix": true,
    "use-input-property-decorator": true,
    "use-output-property-decorator": true,
    "use-host-property-decorator": true,
    "no-input-rename": true,
    "no-output-rename": true,
    "use-life-cycle-interface": true,
    "use-pipe-transform-interface": true,
    "component-class-suffix": true,
    "directive-class-suffix": true,
    "forin": false,
    "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"],
    "no-empty": false,
    "no-jasmine-focus": true
  }
}

Any ideas? Thanks!

postinstall assumes that typings is installed, but it's a devDependency not a regular dependency

We made an empty project and then tried to install the npm package and it failed:

# npm install tslint-jasmine-rules --save-dev

> [email protected] postinstall /Users/pivotal/workspace/fake/node_modules/tslint-jasmine-rules
> typings install

sh: typings: command not found
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.0.0/bin/node" "/usr/local/bin/npm" "install" "tslint-jasmine-rules" "--save-dev"
npm ERR! node v7.0.0
npm ERR! npm  v3.10.8
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] postinstall: `typings install`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the tslint-jasmine-rules package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs tslint-jasmine-rules
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls tslint-jasmine-rules
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/pivotal/workspace/fake/npm-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.