eslint: Disable jasmine env and only enable jest env for test files
Summary: Modified the ESLint configuration to only enable the Jest environment for files we consider now tests, which are files with the `-test.js` suffix under `__tests__`. Also enabled some globals for test helpers (any file under `__tests__`). This will allow us to catch misspelled tests, while allowing test helpers to use most Jest APIs. Also disabled the Jasmine environment so people stop using Jasmine APIs and we can rollout Circus soon. Reviewed By: aaronabramov Differential Revision: D13199591 fbshipit-source-id: 12a32cf5835630b9987452b0c33d3f8085001689
This commit is contained in:
parent
18f3de9dce
commit
2ae559a2a4
33
.eslintrc
33
.eslintrc
|
@ -5,7 +5,6 @@
|
|||
|
||||
"env": {
|
||||
"es6": true,
|
||||
"jest": true,
|
||||
},
|
||||
|
||||
"plugins": [
|
||||
|
@ -14,7 +13,7 @@
|
|||
"prettier",
|
||||
"react",
|
||||
"react-native",
|
||||
"jest"
|
||||
"jest",
|
||||
],
|
||||
|
||||
// Map from global var to bool specifying if it can be redefined
|
||||
|
@ -37,7 +36,6 @@
|
|||
"fetch": false,
|
||||
"FormData": false,
|
||||
"global": false,
|
||||
"jest": false,
|
||||
"Map": true,
|
||||
"module": false,
|
||||
"navigator": false,
|
||||
|
@ -52,8 +50,6 @@
|
|||
"setTimeout": false,
|
||||
"window": false,
|
||||
"XMLHttpRequest": false,
|
||||
"pit": false,
|
||||
"jasmine": true
|
||||
},
|
||||
|
||||
"rules": {
|
||||
|
@ -271,5 +267,32 @@
|
|||
"node": true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"**/__fixtures__/**/*.js",
|
||||
"**/__mocks__/**/*.js",
|
||||
"**/__tests__/**/*.js",
|
||||
"jest/**/*.js",
|
||||
"RNTester/**/*.js",
|
||||
],
|
||||
"globals": {
|
||||
// Expose some Jest globals for test helpers
|
||||
"afterAll": true,
|
||||
"afterEach": true,
|
||||
"beforeAll": true,
|
||||
"beforeEach": true,
|
||||
"expect": true,
|
||||
"jest": true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"**/__tests__/**/*-test.js",
|
||||
],
|
||||
"env": {
|
||||
"jasmine": true,
|
||||
"jest": true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
* @format
|
||||
*/
|
||||
|
||||
/* eslint-env jest */
|
||||
|
||||
'use strict';
|
||||
|
||||
const React = require('React');
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/* eslint-env jasmine */
|
||||
|
||||
const detox = require('detox');
|
||||
const config = require('../../package.json').detox;
|
||||
const config = require('../../../package.json').detox;
|
||||
const adapter = require('detox/runners/jest/adapter');
|
||||
|
||||
jest.setTimeout(480000);
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"setupTestFrameworkScriptFile" : "./init.js",
|
||||
"setupTestFrameworkScriptFile" : "./__tests__/init.js",
|
||||
"testEnvironment": "node",
|
||||
"bail": true,
|
||||
"verbose": true
|
||||
|
|
Loading…
Reference in New Issue