Package Exports
- eslint-plugin-tmaiadev-jest-rules
- eslint-plugin-tmaiadev-jest-rules/eslint-plugin-tmaiadev-jest-rules.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-tmaiadev-jest-rules) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ESLint Plugin TMaiaDev Jest Rules
This ESLint Plugin will enforce your Jest tests to follow the "Given When Then" and the "it should" patterns.
Setup
- Install the dependency
npm install eslint-plugin-tmaiadev-jest-rules --save-dev- Configure your .eslintrc file by adding the plugin to the plugins array, and the rules you want to the rules object.
{
// ...
plugins: [
// ...
"eslint-plugin-tmaiadev-jest-rules",
],
rules: {
// ...
"tmaiadev-jest-rules/enforce-gwt": "error",
"tmaiadev-jest-rules/enforce-gwt-capitalized": "error",
"tmaiadev-jest-rules/enforce-it-should": "error",
},
}Examples
describe('Given that the user has landed on the product page', () => {
describe('When the user clicks on the buy button', () => {
test('Then the product should be added to the shopping cart', () => {
// ...
});
describe('And the product has already been added on the shopping card', () => {
test('Then the number of items of that product should be increased by 1', () => {
// ...
});
});
});
});describe('Given `isDev()`', () => {
it('should return true', () => {
expect(isDev()).toBe(true);
});
});