diff --git a/.eslintrc b/.eslintrc index 983395c98..5cd40ef1d 100644 --- a/.eslintrc +++ b/.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, + }, + }, ], } diff --git a/Libraries/Utilities/ReactNativeTestTools.js b/Libraries/Utilities/ReactNativeTestTools.js index bcab51684..a697912e2 100644 --- a/Libraries/Utilities/ReactNativeTestTools.js +++ b/Libraries/Utilities/ReactNativeTestTools.js @@ -8,6 +8,8 @@ * @format */ +/* eslint-env jest */ + 'use strict'; const React = require('React'); diff --git a/RNTester/e2e/init.js b/RNTester/e2e/__tests__/init.js similarity index 89% rename from RNTester/e2e/init.js rename to RNTester/e2e/__tests__/init.js index 051d52567..96c2562ff 100644 --- a/RNTester/e2e/init.js +++ b/RNTester/e2e/__tests__/init.js @@ -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); diff --git a/RNTester/e2e/sanity.test.js b/RNTester/e2e/__tests__/sanity-test.js similarity index 100% rename from RNTester/e2e/sanity.test.js rename to RNTester/e2e/__tests__/sanity-test.js diff --git a/RNTester/e2e/config.json b/RNTester/e2e/config.json index 4dac170d3..3e2fe55b3 100644 --- a/RNTester/e2e/config.json +++ b/RNTester/e2e/config.json @@ -1,5 +1,5 @@ { - "setupTestFrameworkScriptFile" : "./init.js", + "setupTestFrameworkScriptFile" : "./__tests__/init.js", "testEnvironment": "node", "bail": true, "verbose": true diff --git a/local-cli/templates/HelloWorld/__tests__/App.js b/local-cli/templates/HelloWorld/__tests__/App-test.js similarity index 100% rename from local-cli/templates/HelloWorld/__tests__/App.js rename to local-cli/templates/HelloWorld/__tests__/App-test.js