File tree Expand file tree Collapse file tree 4 files changed +66
-6
lines changed Expand file tree Collapse file tree 4 files changed +66
-6
lines changed Original file line number Diff line number Diff line change 1
- plugins :
2
- - ' jest'
3
- env :
4
- jest/globals : yes
1
+ # extends:
2
+ # - 'plugin:jest/recommended'
3
+
4
+ overrides :
5
+ - files :
6
+ - ' test/**'
7
+ - ' __test__/**'
8
+ - ' *.test.*'
9
+ - ' *.spec.*'
10
+ - ' *.unit.*'
11
+ - ' *.e2e.*'
12
+ extends :
13
+ - ' plugin:jest/recommended'
14
+ settings :
15
+ jest :
16
+ version : ' detect'
17
+
18
+ rules :
19
+ # prevent return statements in tests
20
+ jest/no-test-return-statement : ' error'
21
+
22
+ # use jest comparators instead of comparing booleans
23
+ jest/prefer-comparison-matcher : ' error'
24
+ jest/prefer-equality-matcher : ' error'
25
+
26
+ # require hooks to be inside a describe
27
+ jest/require-top-level-describe : ' error'
Original file line number Diff line number Diff line change 18
18
"license" : " MIT" ,
19
19
"main" : " base.yaml" ,
20
20
"scripts" : {
21
- "test" : " echo 'No tests'; exit 0 "
21
+ "test" : " node --require ts-node/register --test test/index.ts "
22
22
},
23
23
"dependencies" : {
24
- "@shopify/ eslint-plugin" : " ^43.0 .0"
24
+ "eslint-plugin-jest " : " ^27.4 .0"
25
25
},
26
26
"peerDependencies" : {
27
27
"@dudeofawesome/eslint-config" : " ^1.3.0" ,
Original file line number Diff line number Diff line change
1
+ root : true
2
+ extends :
3
+ - ' @dudeofawesome'
4
+ - ' @dudeofawesome/jest'
5
+ parserOptions :
6
+ ecmaVersion : 2022
Original file line number Diff line number Diff line change
1
+ import { describe , it } from 'node:test' ;
2
+ import { ESLint } from 'eslint' ;
3
+ import {
4
+ testRuleFail ,
5
+ testNoFail ,
6
+ defaultTestSet ,
7
+ } from '../../utils/testing/eslint' ;
8
+
9
+ const linter = new ESLint ( { cwd : __dirname } ) ;
10
+
11
+ describe ( 'eslint-config-node' , ( ) => {
12
+ defaultTestSet ( linter ) ;
13
+
14
+ describe ( 'passes' , ( ) => {
15
+ it ( `should have jest globals in test file` , ( ) =>
16
+ testNoFail ( {
17
+ linter,
18
+ code : `describe('test', () => {});\n` ,
19
+ file_path : 'test/thing.js' ,
20
+ } ) ) ;
21
+ } ) ;
22
+
23
+ describe ( 'fails' , ( ) => {
24
+ it ( `should not have jest globals in non-test file` , ( ) =>
25
+ testRuleFail ( {
26
+ linter,
27
+ code : `describe('test', () => {});\n` ,
28
+ ruleId : 'no-undef' ,
29
+ } ) ) ;
30
+ } ) ;
31
+ } ) ;
You can’t perform that action at this time.
0 commit comments