tslint-plugin-cypress
Set of tslint rules for testing with cypress.io.
Motivation
Main purpose of this package is to prevent working with return values of Cypress commands.
From cypress.io:
You cannot assign or work with the return values of any Cypress command. Commands are enqueued and run asynchronously.
How to use?
Typescript and tslint has to be installed and setup.
npm i -D tslint-plugin-cypress
Then add these to your tslint.json
file.
{
"extends": "tslint-plugin-cypress"
}
Run
./node_modules/.bin/tslint -c tslint.json -p . cypress/**/*.ts -t stylish
If you have troubles with setup, Look at example repo here.
Note: Unfortunately, VS code doesn't support plugins which requires type information.
Rules
no-chainable-assignment
Prevents assignment return values of Cypress commands (type Chainable
) to variables. Includes variable declaration, assignment to existing variable, object property assignment and array literal expressions.
no-chainable-arguments
Prevents passing return values of Cypress commands (type Chainable
) to function arguments.