|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | | -const consistentTestIt = require('./rules/consistent-test-it'); |
4 | | -const expectExpect = require('./rules/expect-expect'); |
5 | | -const lowercaseName = require('./rules/lowercase-name'); |
6 | | -const noDisabledTests = require('./rules/no-disabled-tests'); |
7 | | -const noFocusedTests = require('./rules/no-focused-tests'); |
8 | | -const noHooks = require('./rules/no-hooks'); |
9 | | -const noIdenticalTitle = require('./rules/no-identical-title'); |
10 | | -const noJasmineGlobals = require('./rules/no-jasmine-globals'); |
11 | | -const noJestImport = require('./rules/no-jest-import'); |
12 | | -const noLargeSnapshots = require('./rules/no-large-snapshots'); |
13 | | -const noTestPrefixes = require('./rules/no-test-prefixes'); |
14 | | -const noTestReturnStatement = require('./rules/no-test-return-statement'); |
15 | | -const preferSpyOn = require('./rules/prefer-spy-on'); |
16 | | -const preferToBeNull = require('./rules/prefer-to-be-null'); |
17 | | -const preferToBeUndefined = require('./rules/prefer-to-be-undefined'); |
18 | | -const preferToContain = require('./rules/prefer-to-contain'); |
19 | | -const preferToHaveLength = require('./rules/prefer-to-have-length'); |
20 | | -const validDescribe = require('./rules/valid-describe'); |
21 | | -const validExpect = require('./rules/valid-expect'); |
22 | | -const preferExpectAssertions = require('./rules/prefer-expect-assertions'); |
23 | | -const validExpectInPromise = require('./rules/valid-expect-in-promise'); |
24 | | -const preferInlineSnapshots = require('./rules/prefer-inline-snapshots'); |
25 | | -const preferStrictEqual = require('./rules/prefer-strict-equal'); |
26 | | -const requireTothrowMessage = require('./rules/require-tothrow-message'); |
27 | | -const noAliasMethods = require('./rules/no-alias-methods'); |
28 | | -const noTestCallback = require('./rules/no-test-callback'); |
29 | | -const noTruthyFalsy = require('./rules/no-truthy-falsy'); |
30 | | -const preferTodo = require('./rules/prefer-todo'); |
31 | | -const preferCalledWith = require('./rules/prefer-called-with'); |
| 3 | +const fs = require('fs'); |
| 4 | +const path = require('path'); |
| 5 | + |
| 6 | +const rules = fs |
| 7 | + .readdirSync(path.join(__dirname, 'rules')) |
| 8 | + .filter(rule => rule !== '__tests__' && rule !== 'util.js') |
| 9 | + .map(rule => path.basename(rule, '.js')) |
| 10 | + .reduce( |
| 11 | + (acc, curr) => Object.assign(acc, { [curr]: require(`./rules/${curr}`) }), |
| 12 | + {} |
| 13 | + ); |
32 | 14 |
|
33 | 15 | const snapshotProcessor = require('./processors/snapshot-processor'); |
34 | 16 |
|
@@ -88,35 +70,5 @@ module.exports = { |
88 | 70 | processors: { |
89 | 71 | '.snap': snapshotProcessor, |
90 | 72 | }, |
91 | | - rules: { |
92 | | - 'consistent-test-it': consistentTestIt, |
93 | | - 'expect-expect': expectExpect, |
94 | | - 'lowercase-name': lowercaseName, |
95 | | - 'no-disabled-tests': noDisabledTests, |
96 | | - 'no-focused-tests': noFocusedTests, |
97 | | - 'no-hooks': noHooks, |
98 | | - 'no-identical-title': noIdenticalTitle, |
99 | | - 'no-jasmine-globals': noJasmineGlobals, |
100 | | - 'no-jest-import': noJestImport, |
101 | | - 'no-large-snapshots': noLargeSnapshots, |
102 | | - 'no-test-prefixes': noTestPrefixes, |
103 | | - 'no-test-return-statement': noTestReturnStatement, |
104 | | - 'prefer-spy-on': preferSpyOn, |
105 | | - 'prefer-to-be-null': preferToBeNull, |
106 | | - 'prefer-to-be-undefined': preferToBeUndefined, |
107 | | - 'prefer-to-contain': preferToContain, |
108 | | - 'prefer-to-have-length': preferToHaveLength, |
109 | | - 'valid-describe': validDescribe, |
110 | | - 'valid-expect': validExpect, |
111 | | - 'prefer-expect-assertions': preferExpectAssertions, |
112 | | - 'valid-expect-in-promise': validExpectInPromise, |
113 | | - 'prefer-inline-snapshots': preferInlineSnapshots, |
114 | | - 'prefer-strict-equal': preferStrictEqual, |
115 | | - 'require-tothrow-message': requireTothrowMessage, |
116 | | - 'no-alias-methods': noAliasMethods, |
117 | | - 'no-test-callback': noTestCallback, |
118 | | - 'no-truthy-falsy': noTruthyFalsy, |
119 | | - 'prefer-todo': preferTodo, |
120 | | - 'prefer-called-with': preferCalledWith, |
121 | | - }, |
| 73 | + rules, |
122 | 74 | }; |
0 commit comments