-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.js
95 lines (94 loc) · 3.45 KB
/
jest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/
module.exports = {
plugins: ['jest'],
env: { 'jest/globals': true },
rules: {
// have control over `test` and `it` usages
'jest/consistent-test-it': 0,
// enforce assertion to be made in a test body
'jest/expect-expect': 2,
// enforce lowercase test names
'jest/lowercase-name': [1, { ignore: ['describe'] }],
// disallow alias methods
'jest/no-alias-methods': 2,
// disallow commented out tests
'jest/no-commented-out-tests': 2,
// prevent calling `expect` conditionally
'jest/no-conditional-expect': 0,
// disallow use of deprecated functions
'jest/no-deprecated-functions': 2,
// disallow disabled tests
'jest/no-disabled-tests': 2,
// avoid using a callback in asynchronous tests and hooks
'jest/no-done-callback': 2,
// disallow duplicate setup and teardown hooks
'jest/no-duplicate-hooks': 2,
// disallow using `exports` in files containing tests
'jest/no-export': 2,
// disallow focused tests
'jest/no-focused-tests': 2,
// disallow setup and teardown hooks
'jest/no-hooks': 0,
// disallow identical titles
'jest/no-identical-title': 2,
// disallow conditional logic
'jest/no-if': 0,
// disallow string interpolation inside snapshots
'jest/no-interpolation-in-snapshots': 2,
// disallow Jasmine globals
'jest/no-jasmine-globals': 2,
// disallow importing Jest
'jest/no-jest-import': 2,
// disallow large snapshots
'jest/no-large-snapshots': 0,
// disallow manually importing from `__mocks__`
'jest/no-mocks-import': 2,
// disallow specific matchers & modifiers
'jest/no-restricted-matchers': 0,
// disallow using `expect` outside of `it` or `test` blocks
'jest/no-standalone-expect': 2,
// use `.only` and `.skip` over `f` and `x`
'jest/no-test-prefixes': 2,
// disallow explicitly returning from tests
'jest/no-test-return-statement': 2,
// suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()`
'jest/prefer-called-with': 0,
// suggest using `expect.assertions()` OR `expect.hasAssertions()`
'jest/prefer-expect-assertions': 0,
// suggest `await expect(...).resolves` over `expect(await ...)` syntax
'jest/prefer-expect-resolves': 2,
// suggest having hooks before any test cases
'jest/prefer-hooks-on-top': 0,
// suggest using `jest.spyOn()`
'jest/prefer-spy-on': 0,
// suggest using `toStrictEqual()`
'jest/prefer-strict-equal': 1,
// suggest using `toBe()` for primitive literals
'jest/prefer-to-be': 2,
// suggest using `toContain()`
'jest/prefer-to-contain': 2,
// suggest using `toHaveLength()`
'jest/prefer-to-have-length': 2,
// suggest using `test.todo`
'jest/prefer-todo': 1,
// require setup and teardown code to be within a hook
'jest/require-hook': 2,
// require a message for `toThrow()`
'jest/require-to-throw-message': 0,
// require test cases and hooks to be inside a `describe` block
'jest/require-top-level-describe': 2,
// enforce valid `describe()` callback
'jest/valid-describe': 2,
// enforce valid `expect()` usage
'jest/valid-expect': 2,
// enforce having return statement when testing with promises
'jest/valid-expect-in-promise': 2,
// enforce valid titles
'jest/valid-title': 2
}
};