ESLint plugin with rules for ProdPerfect customer test suites
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-prodperfectqa
:
$ npm install "https://github.com/ProdPerfect/eslint-plugin-prodperfectqa" --save-dev
Add prodperfectqa
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["prodperfectqa"]
}
To use the recommended configuration for customer test suites, add plugin:prodperfectqa/recommended
to the extends
{
"extends": ["plugin:prodperfectqa/recommended"]
}
Alternately, configure the specific rules you want to use under the rules section.
{
"rules": {
"prodperfectqa/no-only": "error",
"prodperfectqa/no-skip": "warn",
"prodperfectqa/no-debug": "error"
}
}
Name | ✔️ | 🛠 | Description |
---|---|---|---|
no-debug | ✔️ | Prevent use of .debug method on tests and fixtures |
|
no-native-test | ✔️ | Prevent use of TestCafe's native test function |
|
no-only | ✔️ | Prevent use of .only method on tests and fixtures |
|
no-p2-tracking | ✔️ | Prevent use of deprecated methods setProdPerfectTracking and setProdPerfectCookie | |
no-skip | ✔️ | Prevent use of .skip method on tests and fixtures |
|
valid-test-name | ✔️ | Validate test name | |
valid-test-metadata | ✔️ | Validate test metadata |
The rules set for best practices are based off eslint and unicorn recommended rules:
Override rules by configuring specific rules in your eslint configuration file
{
"rules": {
"no-undef": "off",
"semi": "warn",
"unicorn/filename-case": ["error", { case: "camelCase" }],
}
}