eslint-plugin-jest
Version:
Eslint rules for Jest
29 lines (23 loc) • 863 B
JavaScript
;
const fs = require('fs');
const path = require('path');
const _require = require('../'),
rules = _require.rules;
const ruleNames = Object.keys(rules);
const numberOfRules = 32;
describe('rules', () => {
it('should have a corresponding doc for each rule', () => {
ruleNames.forEach(rule => {
const docPath = path.resolve(__dirname, '../../docs/rules', `${rule}.md`);
if (!fs.existsSync(docPath)) {
throw new Error(`Could not find documentation file for rule "${rule}" in path "${docPath}"`);
}
});
});
it('should have the correct amount of rules', () => {
const length = ruleNames.length;
if (length !== numberOfRules) {
throw new Error(`There should be exactly ${numberOfRules} rules, but there are ${length}. If you've added a new rule, please update this number.`);
}
});
});