This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
jest.js
64 lines (63 loc) · 2.79 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
// see https://github.com/jest-community/eslint-plugin-jest
module.exports = {
// Enforce assertion to be made in a test body
'jest/expect-expect': 'error',
// Disallow all forms of skipped tests (`.skip`, prepending `x` to test helpers, empty function bodies, `pending()` calls.)
'jest/no-disabled-tests': 'error',
// Disallow disabling tests via appending `.only` or prepending `f` to test helpers.
'jest/no-focused-tests': 'error',
// Make it easier to find failing tests by preventing duplicate test names in a suite.
'jest/no-identical-title': 'error',
// Disallow Jasmine globals
'jest/no-jasmine-globals': 'error',
// Limited snapshot sizes to keep snapshops manageable and reviewable.
'jest/no-large-snapshots': ['error', {maxSize: 12}],
// For better failure messages, use `toHaveLength()` to on object lengths.
'jest/prefer-to-have-length': 'error',
// Suggest using toMatchInlineSnapshot()
'jest/prefer-inline-snapshots': 'off',
// For better failure messages, use `toBeNull()` to assert on null values.
'jest/prefer-to-be-null': 'error',
// For better failure messages, use `toBeUndefined()` to assert on undefined values.
'jest/prefer-to-be-undefined': 'error',
// Ensure `expect()` is called with a single argument and there is an actual expectation made.
'jest/valid-expect': 'error',
// Suggest using expect.assertions() OR expect.hasAssertions()
'jest/prefer-expect-assertions': 'off',
// Enforce having return statement when testing with promises
'jest/valid-expect-in-promise': 'error',
// Enforce valid describe() callback
'jest/valid-describe': 'error',
// Have control over test and it usages
'jest/consistent-test-it': 'error',
// Use .only and .skip over f and x
'jest/no-test-prefixes': 'error',
// Disallow explicitly returning from tests
'jest/no-test-return-statement': 'error',
// Enforce lowercase test names
'jest/lowercase-name': ['error', {ignore: ['describe']}],
// Disallow importing Jest
'jest/no-jest-import': 'error',
// Disallow alias methods
'jest/no-alias-methods': 'error',
// Disallow setup and teardown hooks
'jest/no-hooks': 'off',
// Using a callback in asynchronous tests
'jest/no-test-callback': 'error',
// Disallow using toBeTruthy() & toBeFalsy()
'jest/no-truthy-falsy': 'error',
// Suggest using toBeCalledWith() OR toHaveBeenCalledWith()
'jest/prefer-called-with': 'off',
// Suggest using jest.spyOn()
'jest/prefer-spy-on': 'error',
// Suggest using toStrictEqual()
'jest/prefer-strict-equal': 'error',
// Suggest using toContain()
'jest/prefer-to-contain': 'error',
// Suggest using test.todo()
'jest/prefer-todo': 'error',
// Require that toThrow() and toThrowError includes a message
'jest/require-tothrow-message': 'error',
// Disallow empty titles
'jest/no-empty-title': 'error',
};