jest.js
1.53 KB
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
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// We use eslint-loader so even warnings are very visible.
// This is why we prefer to use "WARNING" level for potential errors,
// and we try not to use "ERROR" level at all.
module.exports = {
plugins: ['jest', 'testing-library'],
overrides: [
{
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
env: {
'jest/globals': true,
},
// A subset of the recommended rules:
rules: {
// https://github.com/jest-community/eslint-plugin-jest
'jest/no-conditional-expect': 'error',
'jest/no-identical-title': 'error',
'jest/no-interpolation-in-snapshots': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-jest-import': 'error',
'jest/no-mocks-import': 'error',
'jest/valid-describe': 'error',
'jest/valid-expect': 'error',
'jest/valid-expect-in-promise': 'error',
'jest/valid-title': 'warn',
// https://github.com/testing-library/eslint-plugin-testing-library
'testing-library/await-async-query': 'error',
'testing-library/await-async-utils': 'error',
'testing-library/no-await-sync-query': 'warn',
'testing-library/no-dom-import': ['error', 'react'],
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/no-wait-for-snapshot': 'error',
},
},
],
};