diff --git a/.eslintrc.js b/.eslintrc.js index 347ca90d1ae8..307b3d927be3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -71,7 +71,7 @@ module.exports = { }, { files: [ - 'e2e/__tests__/**/*', + 'e2e/__tests__/**/*.js', 'packages/babel-jest/**/*.test.js', 'packages/babel-plugin-jest-hoist/**/*.test.js', 'packages/babel-preset-jest/**/*.test.js', diff --git a/e2e/MockStdinWatchPlugin.js b/e2e/MockStdinWatchPlugin.js index f6d5331dacfd..e22c6400d218 100644 --- a/e2e/MockStdinWatchPlugin.js +++ b/e2e/MockStdinWatchPlugin.js @@ -24,4 +24,9 @@ class MockStdinWatchPlugin { }); } } + +/** + * Watch plugins are not transpiled hence why we're leaving + * this file out of typescript migration + */ module.exports = MockStdinWatchPlugin; diff --git a/e2e/Utils.js b/e2e/Utils.ts similarity index 86% rename from e2e/Utils.js rename to e2e/Utils.ts index 57e80a2fcd0f..1f5daba040ce 100644 --- a/e2e/Utils.js +++ b/e2e/Utils.ts @@ -4,23 +4,24 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow */ -'use strict'; - -import type {Path} from 'types/Config'; - -import {sync as spawnSync} from 'execa'; import fs from 'fs'; import path from 'path'; +import {Config} from '@jest/types'; + +import {sync as spawnSync, ExecaReturns} from 'execa'; import {createDirectory} from 'jest-util'; import rimraf from 'rimraf'; -export const run = (cmd: string, cwd?: Path) => { +export type RunResult = ExecaReturns & { + status: number; + error: Error; +}; +export const run = (cmd: string, cwd?: Config.Path): RunResult => { const args = cmd.split(/\s/).slice(1); const spawnOptions = {cwd, reject: false}; - const result = spawnSync(cmd.split(/\s/)[0], args, spawnOptions); + const result = spawnSync(cmd.split(/\s/)[0], args, spawnOptions) as RunResult; // For compat with cross-spawn result.status = result.code; @@ -39,7 +40,7 @@ export const run = (cmd: string, cwd?: Path) => { return result; }; -export const linkJestPackage = (packageName: string, cwd: Path) => { +export const linkJestPackage = (packageName: string, cwd: Config.Path) => { const packagesDir = path.resolve(__dirname, '../packages'); const packagePath = path.resolve(packagesDir, packageName); const destination = path.resolve(cwd, 'node_modules/', packageName); @@ -50,8 +51,8 @@ export const linkJestPackage = (packageName: string, cwd: Path) => { export const makeTemplate = ( str: string, -): ((values?: Array) => string) => (values: ?Array) => - str.replace(/\$(\d+)/g, (match, number) => { +): ((values?: Array) => string) => (values?: Array) => + str.replace(/\$(\d+)/g, (_match, number) => { if (!Array.isArray(values)) { throw new Error('Array of values must be passed to the template.'); } @@ -76,14 +77,13 @@ export const writeFiles = ( ) => { createDirectory(directory); Object.keys(files).forEach(fileOrPath => { - const filePath = fileOrPath.split('/'); // ['tmp', 'a.js'] - const filename = filePath.pop(); // filepath becomes dirPath (no filename) + const dirname = path.dirname(fileOrPath); - if (filePath.length) { - createDirectory(path.join.apply(path, [directory].concat(filePath))); + if (dirname !== '/') { + createDirectory(path.join(directory, dirname)); } fs.writeFileSync( - path.resolve.apply(path, [directory].concat(filePath, [filename])), + path.resolve(directory, ...fileOrPath.split('/')), files[fileOrPath], ); }); @@ -118,7 +118,7 @@ export const sortLines = (output: string) => .join('\n'); export const createEmptyPackage = ( - directory: Path, + directory: Config.Path, packageJson?: {[keys: string]: any}, ) => { const DEFAULT_PACKAGE_JSON = { @@ -168,7 +168,7 @@ export const extractSummary = (stdout: string) => { const sortTests = (stdout: string) => stdout .split('\n') - .reduce((tests, line, i) => { + .reduce((tests: Array>, line) => { if (['RUNS', 'PASS', 'FAIL'].includes(line.slice(0, 4))) { tests.push([line.trimRight()]); } else if (line) { @@ -194,11 +194,11 @@ export const extractSortedSummary = (stdout: string) => { export const extractSummaries = ( stdout: string, -): Array<{rest: string, summary: string}> => { +): Array<{rest: string; summary: string}> => { const regex = /Test Suites:.*\nTests.*\nSnapshots.*\nTime.*(\nRan all test suites)*.*\n*$/gm; let match = regex.exec(stdout); - const matches = []; + const matches: Array = []; while (match) { matches.push(match); diff --git a/e2e/__tests__/__snapshots__/beforeAllFiltered.js.snap b/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/beforeAllFiltered.js.snap rename to e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap diff --git a/e2e/__tests__/__snapshots__/beforeEachQueue.js.snap b/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/beforeEachQueue.js.snap rename to e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap diff --git a/e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.js.snap b/e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.js.snap rename to e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/console.test.js.snap b/e2e/__tests__/__snapshots__/console.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/console.test.js.snap rename to e2e/__tests__/__snapshots__/console.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.js.snap b/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/consoleAfterTeardown.test.js.snap rename to e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.js.snap b/e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.js.snap rename to e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/coverageRemapping.test.js.snap b/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/coverageRemapping.test.js.snap rename to e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/coverageReport.test.js.snap b/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/coverageReport.test.js.snap rename to e2e/__tests__/__snapshots__/coverageReport.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/coverageThreshold.test.js.snap b/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/coverageThreshold.test.js.snap rename to e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/coverageTransformInstrumented.test.js.snap b/e2e/__tests__/__snapshots__/coverageTransformInstrumented.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/coverageTransformInstrumented.test.js.snap rename to e2e/__tests__/__snapshots__/coverageTransformInstrumented.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap rename to e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/customReporters.test.js.snap b/e2e/__tests__/__snapshots__/customReporters.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/customReporters.test.js.snap rename to e2e/__tests__/__snapshots__/customReporters.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/detectOpenHandles.js.snap b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/detectOpenHandles.js.snap rename to e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap diff --git a/e2e/__tests__/__snapshots__/each.test.js.snap b/e2e/__tests__/__snapshots__/each.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/each.test.js.snap rename to e2e/__tests__/__snapshots__/each.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.js.snap b/e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.js.snap rename to e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.js.snap b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/environmentAfterTeardown.test.js.snap rename to e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/errorOnDeprecated.test.js.snap b/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/errorOnDeprecated.test.js.snap rename to e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/executeTestsOnceInMpr.js.snap b/e2e/__tests__/__snapshots__/executeTestsOnceInMpr.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/executeTestsOnceInMpr.js.snap rename to e2e/__tests__/__snapshots__/executeTestsOnceInMpr.ts.snap diff --git a/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.js.snap b/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/expectAsyncMatcher.test.js.snap rename to e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/failures.test.js.snap b/e2e/__tests__/__snapshots__/failures.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/failures.test.js.snap rename to e2e/__tests__/__snapshots__/failures.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/findRelatedFiles.test.js.snap b/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/findRelatedFiles.test.js.snap rename to e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/globals.test.js.snap b/e2e/__tests__/__snapshots__/globals.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/globals.test.js.snap rename to e2e/__tests__/__snapshots__/globals.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/jest.config.js.test.js.snap b/e2e/__tests__/__snapshots__/jest.config.js.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/jest.config.js.test.js.snap rename to e2e/__tests__/__snapshots__/jest.config.js.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/jestChangedFiles.test.js.snap b/e2e/__tests__/__snapshots__/jestChangedFiles.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/jestChangedFiles.test.js.snap rename to e2e/__tests__/__snapshots__/jestChangedFiles.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/listTests.test.js.snap b/e2e/__tests__/__snapshots__/listTests.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/listTests.test.js.snap rename to e2e/__tests__/__snapshots__/listTests.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/moduleNameMapper.test.js.snap b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/moduleNameMapper.test.js.snap rename to e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/multiProjectRunner.test.js.snap b/e2e/__tests__/__snapshots__/multiProjectRunner.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/multiProjectRunner.test.js.snap rename to e2e/__tests__/__snapshots__/multiProjectRunner.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/processExit.test.js.snap b/e2e/__tests__/__snapshots__/processExit.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/processExit.test.js.snap rename to e2e/__tests__/__snapshots__/processExit.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.js.snap b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/requireAfterTeardown.test.js.snap rename to e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.js.snap b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.js.snap rename to e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/showConfig.test.js.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/showConfig.test.js.snap rename to e2e/__tests__/__snapshots__/showConfig.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/snapshot.test.js.snap b/e2e/__tests__/__snapshots__/snapshot.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/snapshot.test.js.snap rename to e2e/__tests__/__snapshots__/snapshot.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/snapshotMockFs.test.js.snap b/e2e/__tests__/__snapshots__/snapshotMockFs.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/snapshotMockFs.test.js.snap rename to e2e/__tests__/__snapshots__/snapshotMockFs.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/snapshotSerializers.test.js.snap b/e2e/__tests__/__snapshots__/snapshotSerializers.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/snapshotSerializers.test.js.snap rename to e2e/__tests__/__snapshots__/snapshotSerializers.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/stackTrace.test.js.snap b/e2e/__tests__/__snapshots__/stackTrace.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/stackTrace.test.js.snap rename to e2e/__tests__/__snapshots__/stackTrace.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/testNamePattern.test.js.snap b/e2e/__tests__/__snapshots__/testNamePattern.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/testNamePattern.test.js.snap rename to e2e/__tests__/__snapshots__/testNamePattern.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/testNamePatternSkipped.test.js.snap b/e2e/__tests__/__snapshots__/testNamePatternSkipped.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/testNamePatternSkipped.test.js.snap rename to e2e/__tests__/__snapshots__/testNamePatternSkipped.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/testTodo.test.js.snap b/e2e/__tests__/__snapshots__/testTodo.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/testTodo.test.js.snap rename to e2e/__tests__/__snapshots__/testTodo.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/timeouts.test.js.snap b/e2e/__tests__/__snapshots__/timeouts.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/timeouts.test.js.snap rename to e2e/__tests__/__snapshots__/timeouts.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/timeoutsLegacy.test.js.snap b/e2e/__tests__/__snapshots__/timeoutsLegacy.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/timeoutsLegacy.test.js.snap rename to e2e/__tests__/__snapshots__/timeoutsLegacy.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.js.snap b/e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.js.snap rename to e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.js.snap b/e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.js.snap rename to e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.js.snap b/e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.js.snap rename to e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/transform.test.js.snap b/e2e/__tests__/__snapshots__/transform.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/transform.test.js.snap rename to e2e/__tests__/__snapshots__/transform.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/typescriptCoverage.test.js.snap b/e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/typescriptCoverage.test.js.snap rename to e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.js.snap b/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.js.snap rename to e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/watchModePatterns.test.js.snap b/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/watchModePatterns.test.js.snap rename to e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap diff --git a/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.js.snap b/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap similarity index 100% rename from e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.js.snap rename to e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap diff --git a/e2e/__tests__/asyncRegenerator.test.js b/e2e/__tests__/asyncRegenerator.test.ts similarity index 98% rename from e2e/__tests__/asyncRegenerator.test.js rename to e2e/__tests__/asyncRegenerator.test.ts index 34466352e3d6..99e737af2d17 100644 --- a/e2e/__tests__/asyncRegenerator.test.js +++ b/e2e/__tests__/asyncRegenerator.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/autoClearMocks.test.js b/e2e/__tests__/autoClearMocks.test.ts similarity index 97% rename from e2e/__tests__/autoClearMocks.test.js rename to e2e/__tests__/autoClearMocks.test.ts index 1b352e1d1943..1033aff68e87 100644 --- a/e2e/__tests__/autoClearMocks.test.js +++ b/e2e/__tests__/autoClearMocks.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/autoResetMocks.test.js b/e2e/__tests__/autoResetMocks.test.ts similarity index 97% rename from e2e/__tests__/autoResetMocks.test.js rename to e2e/__tests__/autoResetMocks.test.ts index 01346d698908..69fc1758df9e 100644 --- a/e2e/__tests__/autoResetMocks.test.js +++ b/e2e/__tests__/autoResetMocks.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/autoRestoreMocks.test.js b/e2e/__tests__/autoRestoreMocks.test.ts similarity index 97% rename from e2e/__tests__/autoRestoreMocks.test.js rename to e2e/__tests__/autoRestoreMocks.test.ts index 7f2366d5282a..ada6696f64f6 100644 --- a/e2e/__tests__/autoRestoreMocks.test.js +++ b/e2e/__tests__/autoRestoreMocks.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/babelPluginJestHoist.test.js b/e2e/__tests__/babelPluginJestHoist.test.ts similarity index 98% rename from e2e/__tests__/babelPluginJestHoist.test.js rename to e2e/__tests__/babelPluginJestHoist.test.ts index 6820262f5960..aa65b5c317d9 100644 --- a/e2e/__tests__/babelPluginJestHoist.test.js +++ b/e2e/__tests__/babelPluginJestHoist.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/badSourceMap.test.js b/e2e/__tests__/badSourceMap.test.ts similarity index 97% rename from e2e/__tests__/badSourceMap.test.js rename to e2e/__tests__/badSourceMap.test.ts index 471703726e60..114a16208f81 100644 --- a/e2e/__tests__/badSourceMap.test.js +++ b/e2e/__tests__/badSourceMap.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/beforeAllFiltered.js b/e2e/__tests__/beforeAllFiltered.ts similarity index 97% rename from e2e/__tests__/beforeAllFiltered.js rename to e2e/__tests__/beforeAllFiltered.ts index a930d148ecfd..fdd03d373486 100644 --- a/e2e/__tests__/beforeAllFiltered.js +++ b/e2e/__tests__/beforeAllFiltered.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest from '../runJest'; describe('Correct BeforeAll run', () => { it('ensures the BeforeAll of ignored suite is not run', () => { diff --git a/e2e/__tests__/beforeEachQueue.js b/e2e/__tests__/beforeEachQueue.ts similarity index 97% rename from e2e/__tests__/beforeEachQueue.js rename to e2e/__tests__/beforeEachQueue.ts index 24ff77c3459f..a7d6738b39d5 100644 --- a/e2e/__tests__/beforeEachQueue.js +++ b/e2e/__tests__/beforeEachQueue.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest from '../runJest'; describe('Correct beforeEach order', () => { it('ensures the correct order for beforeEach', () => { diff --git a/e2e/__tests__/clearCache.test.js b/e2e/__tests__/clearCache.test.ts similarity index 98% rename from e2e/__tests__/clearCache.test.js rename to e2e/__tests__/clearCache.test.ts index 96e6d3207aa1..4cd0ce27b348 100644 --- a/e2e/__tests__/clearCache.test.js +++ b/e2e/__tests__/clearCache.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; diff --git a/e2e/__tests__/cliHandlesExactFilenames.test.js b/e2e/__tests__/cliHandlesExactFilenames.test.ts similarity index 95% rename from e2e/__tests__/cliHandlesExactFilenames.test.js rename to e2e/__tests__/cliHandlesExactFilenames.test.ts index 263a012eec9e..93c321a26aa3 100644 --- a/e2e/__tests__/cliHandlesExactFilenames.test.js +++ b/e2e/__tests__/cliHandlesExactFilenames.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; -import {skipSuiteOnWindows} from '../../scripts/ConditionalTest'; +import {wrap} from 'jest-snapshot-serializer-raw'; +import {skipSuiteOnWindows} from '@jest/test-utils'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../cli_accepts_exact_filenames'); diff --git a/e2e/__tests__/compareDomNodes.test.js b/e2e/__tests__/compareDomNodes.test.ts similarity index 97% rename from e2e/__tests__/compareDomNodes.test.js rename to e2e/__tests__/compareDomNodes.test.ts index 91bde64e2b2e..9d62f3dde093 100644 --- a/e2e/__tests__/compareDomNodes.test.js +++ b/e2e/__tests__/compareDomNodes.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/config.test.js b/e2e/__tests__/config.test.ts similarity index 99% rename from e2e/__tests__/config.test.js rename to e2e/__tests__/config.test.ts index f0be7331981a..db14f7afd5ea 100644 --- a/e2e/__tests__/config.test.js +++ b/e2e/__tests__/config.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/console.test.js b/e2e/__tests__/console.test.ts similarity index 99% rename from e2e/__tests__/console.test.js rename to e2e/__tests__/console.test.ts index 214566f9c894..b0aaeab78322 100644 --- a/e2e/__tests__/console.test.js +++ b/e2e/__tests__/console.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; test('console printing', () => { const {stderr, status} = runJest('console'); diff --git a/e2e/__tests__/consoleAfterTeardown.test.js b/e2e/__tests__/consoleAfterTeardown.test.ts similarity index 97% rename from e2e/__tests__/consoleAfterTeardown.test.js rename to e2e/__tests__/consoleAfterTeardown.test.ts index 0c12d77720b4..25b87ce8a49e 100644 --- a/e2e/__tests__/consoleAfterTeardown.test.js +++ b/e2e/__tests__/consoleAfterTeardown.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; test('console printing', () => { const {stderr, status} = runJest('console-after-teardown'); diff --git a/e2e/__tests__/consoleLogOutputWhenRunInBand.test.js b/e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts similarity index 98% rename from e2e/__tests__/consoleLogOutputWhenRunInBand.test.js rename to e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts index 3e2c04233607..6fdc68b3ac66 100644 --- a/e2e/__tests__/consoleLogOutputWhenRunInBand.test.js +++ b/e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../console-log-output-when-run-in-band'); diff --git a/e2e/__tests__/coverageRemapping.test.js b/e2e/__tests__/coverageRemapping.test.ts similarity index 99% rename from e2e/__tests__/coverageRemapping.test.js rename to e2e/__tests__/coverageRemapping.test.ts index 12d83544ff72..dd92673f521d 100644 --- a/e2e/__tests__/coverageRemapping.test.js +++ b/e2e/__tests__/coverageRemapping.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {readFileSync} from 'fs'; diff --git a/e2e/__tests__/coverageReport.test.js b/e2e/__tests__/coverageReport.test.ts similarity index 99% rename from e2e/__tests__/coverageReport.test.js rename to e2e/__tests__/coverageReport.test.ts index dc50c3016c08..f7dee0950d78 100644 --- a/e2e/__tests__/coverageReport.test.js +++ b/e2e/__tests__/coverageReport.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../coverage-report'); diff --git a/e2e/__tests__/coverageThreshold.test.js b/e2e/__tests__/coverageThreshold.test.ts similarity index 99% rename from e2e/__tests__/coverageThreshold.test.js rename to e2e/__tests__/coverageThreshold.test.ts index d86abc100554..270ec19fbee7 100644 --- a/e2e/__tests__/coverageThreshold.test.js +++ b/e2e/__tests__/coverageThreshold.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../coverage-threshold'); diff --git a/e2e/__tests__/coverageTransformInstrumented.test.js b/e2e/__tests__/coverageTransformInstrumented.test.ts similarity index 99% rename from e2e/__tests__/coverageTransformInstrumented.test.js rename to e2e/__tests__/coverageTransformInstrumented.test.ts index 0f7227ea7f4c..faa9e6d04efd 100644 --- a/e2e/__tests__/coverageTransformInstrumented.test.js +++ b/e2e/__tests__/coverageTransformInstrumented.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {readFileSync} from 'fs'; diff --git a/e2e/__tests__/customMatcherStackTrace.test.js b/e2e/__tests__/customMatcherStackTrace.test.ts similarity index 98% rename from e2e/__tests__/customMatcherStackTrace.test.js rename to e2e/__tests__/customMatcherStackTrace.test.ts index be338b2b7ee7..155c13b23808 100644 --- a/e2e/__tests__/customMatcherStackTrace.test.js +++ b/e2e/__tests__/customMatcherStackTrace.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import {extractSummary} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; test('works with custom matchers', () => { const {stderr} = runJest('custom-matcher-stack-trace', ['sync.test.js']); diff --git a/e2e/__tests__/customReporters.test.js b/e2e/__tests__/customReporters.test.ts similarity index 99% rename from e2e/__tests__/customReporters.test.js rename to e2e/__tests__/customReporters.test.ts index 9b29a2c1bd61..be5b65293283 100644 --- a/e2e/__tests__/customReporters.test.js +++ b/e2e/__tests__/customReporters.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import {cleanup, extractSummary, writeFiles} from '../Utils'; -import runJest from '../runJest'; import os from 'os'; import path from 'path'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest from '../runJest'; +import {cleanup, extractSummary, writeFiles} from '../Utils'; const DIR = path.resolve(os.tmpdir(), 'custom-reporters-test-dir'); diff --git a/e2e/__tests__/customResolver.test.js b/e2e/__tests__/customResolver.test.ts similarity index 96% rename from e2e/__tests__/customResolver.test.js rename to e2e/__tests__/customResolver.test.ts index f0dac2f418a4..daa777f78b03 100644 --- a/e2e/__tests__/customResolver.test.js +++ b/e2e/__tests__/customResolver.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/debug.test.js b/e2e/__tests__/debug.test.ts similarity index 98% rename from e2e/__tests__/debug.test.js rename to e2e/__tests__/debug.test.ts index 673e4c7ace36..58e9b2904e69 100644 --- a/e2e/__tests__/debug.test.js +++ b/e2e/__tests__/debug.test.ts @@ -3,7 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/dependencyClash.test.js b/e2e/__tests__/dependencyClash.test.ts similarity index 97% rename from e2e/__tests__/dependencyClash.test.js rename to e2e/__tests__/dependencyClash.test.ts index 904defff5297..af55fc289b54 100644 --- a/e2e/__tests__/dependencyClash.test.js +++ b/e2e/__tests__/dependencyClash.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import os from 'os'; +import {skipSuiteOnWindows} from '@jest/test-utils'; import {cleanup, createEmptyPackage, writeFiles} from '../Utils'; import runJest from '../runJest'; -import os from 'os'; -import {skipSuiteOnWindows} from '../../scripts/ConditionalTest'; skipSuiteOnWindows(); diff --git a/e2e/__tests__/deprecatedCliOptions.test.js b/e2e/__tests__/deprecatedCliOptions.test.ts similarity index 98% rename from e2e/__tests__/deprecatedCliOptions.test.js rename to e2e/__tests__/deprecatedCliOptions.test.ts index 4c305750bf88..4f070ab150a4 100644 --- a/e2e/__tests__/deprecatedCliOptions.test.js +++ b/e2e/__tests__/deprecatedCliOptions.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/detectOpenHandles.js b/e2e/__tests__/detectOpenHandles.ts similarity index 99% rename from e2e/__tests__/detectOpenHandles.js rename to e2e/__tests__/detectOpenHandles.ts index 71e8a09bba99..f6b4503e980f 100644 --- a/e2e/__tests__/detectOpenHandles.js +++ b/e2e/__tests__/detectOpenHandles.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest, {until} from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest, {until} from '../runJest'; try { // $FlowFixMe: Node core diff --git a/e2e/__tests__/each.test.js b/e2e/__tests__/each.test.ts similarity index 99% rename from e2e/__tests__/each.test.js rename to e2e/__tests__/each.test.ts index 27103512d246..2082da02c9c1 100644 --- a/e2e/__tests__/each.test.js +++ b/e2e/__tests__/each.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import {extractSummary} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; const dir = path.resolve(__dirname, '../each'); diff --git a/e2e/__tests__/emptyDescribeWithHooks.test.js b/e2e/__tests__/emptyDescribeWithHooks.test.ts similarity index 94% rename from e2e/__tests__/emptyDescribeWithHooks.test.js rename to e2e/__tests__/emptyDescribeWithHooks.test.ts index a9620ecd7d36..158cadb61213 100644 --- a/e2e/__tests__/emptyDescribeWithHooks.test.js +++ b/e2e/__tests__/emptyDescribeWithHooks.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {skipSuiteOnJasmine} from '@jest/test-utils'; import runJest from '../runJest'; import {extractSummary} from '../Utils'; -import {skipSuiteOnJasmine} from '../../scripts/ConditionalTest'; const dir = path.resolve(__dirname, '../empty-describe-with-hooks'); diff --git a/e2e/__tests__/emptySuiteError.test.js b/e2e/__tests__/emptySuiteError.test.ts similarity index 98% rename from e2e/__tests__/emptySuiteError.test.js rename to e2e/__tests__/emptySuiteError.test.ts index 1930514057f6..cfa5a3393f22 100644 --- a/e2e/__tests__/emptySuiteError.test.js +++ b/e2e/__tests__/emptySuiteError.test.ts @@ -3,7 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ 'use strict'; diff --git a/e2e/__tests__/env.test.js b/e2e/__tests__/env.test.ts similarity index 99% rename from e2e/__tests__/env.test.js rename to e2e/__tests__/env.test.ts index 2c2a36527c64..ac849db0a09b 100644 --- a/e2e/__tests__/env.test.js +++ b/e2e/__tests__/env.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/environmentAfterTeardown.test.js b/e2e/__tests__/environmentAfterTeardown.test.ts similarity index 98% rename from e2e/__tests__/environmentAfterTeardown.test.js rename to e2e/__tests__/environmentAfterTeardown.test.ts index 084c7787887f..f9f247964a4e 100644 --- a/e2e/__tests__/environmentAfterTeardown.test.js +++ b/e2e/__tests__/environmentAfterTeardown.test.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest from '../runJest'; test('prints useful error for environment methods after test is done', () => { const {stderr} = runJest('environment-after-teardown'); diff --git a/e2e/__tests__/errorOnDeprecated.test.js b/e2e/__tests__/errorOnDeprecated.test.ts similarity index 95% rename from e2e/__tests__/errorOnDeprecated.test.js rename to e2e/__tests__/errorOnDeprecated.test.ts index 77807210b6e8..f13846fd7ae8 100644 --- a/e2e/__tests__/errorOnDeprecated.test.js +++ b/e2e/__tests__/errorOnDeprecated.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; +import {skipSuiteOnJestCircus} from '@jest/test-utils'; import runJest from '../runJest'; import {extractSummary} from '../Utils'; -import {skipSuiteOnJestCircus} from '../../scripts/ConditionalTest'; -import {wrap} from 'jest-snapshot-serializer-raw'; skipSuiteOnJestCircus(); diff --git a/e2e/__tests__/executeTestsOnceInMpr.js b/e2e/__tests__/executeTestsOnceInMpr.ts similarity index 99% rename from e2e/__tests__/executeTestsOnceInMpr.js rename to e2e/__tests__/executeTestsOnceInMpr.ts index 1ee70319b9fb..5691c8d8d2ca 100644 --- a/e2e/__tests__/executeTestsOnceInMpr.js +++ b/e2e/__tests__/executeTestsOnceInMpr.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../execute-tests-once-in-mpr'); diff --git a/e2e/__tests__/expectAsyncMatcher.test.js b/e2e/__tests__/expectAsyncMatcher.test.ts similarity index 98% rename from e2e/__tests__/expectAsyncMatcher.test.js rename to e2e/__tests__/expectAsyncMatcher.test.ts index f6e91e911e42..069314da4573 100644 --- a/e2e/__tests__/expectAsyncMatcher.test.js +++ b/e2e/__tests__/expectAsyncMatcher.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import {extractSummary} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; const dir = path.resolve(__dirname, '../expect-async-matcher'); test('works with passing tests', () => { diff --git a/e2e/__tests__/expectInVm.test.js b/e2e/__tests__/expectInVm.test.ts similarity index 97% rename from e2e/__tests__/expectInVm.test.js rename to e2e/__tests__/expectInVm.test.ts index 380b9ac5d868..fd34c52e59d5 100644 --- a/e2e/__tests__/expectInVm.test.js +++ b/e2e/__tests__/expectInVm.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/failures.test.js b/e2e/__tests__/failures.test.ts similarity index 99% rename from e2e/__tests__/failures.test.js rename to e2e/__tests__/failures.test.ts index a47e42452539..f99bed6a4938 100644 --- a/e2e/__tests__/failures.test.js +++ b/e2e/__tests__/failures.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const dir = path.resolve(__dirname, '../failures'); diff --git a/e2e/__tests__/fakePromises.test.js b/e2e/__tests__/fakePromises.test.ts similarity index 98% rename from e2e/__tests__/fakePromises.test.js rename to e2e/__tests__/fakePromises.test.ts index 5533b87c7b90..5a5b78c159f3 100644 --- a/e2e/__tests__/fakePromises.test.js +++ b/e2e/__tests__/fakePromises.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/filter.test.js b/e2e/__tests__/filter.test.ts similarity index 99% rename from e2e/__tests__/filter.test.js rename to e2e/__tests__/filter.test.ts index 54fe03bb8a2a..550330fd507f 100644 --- a/e2e/__tests__/filter.test.js +++ b/e2e/__tests__/filter.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/findRelatedFiles.test.js b/e2e/__tests__/findRelatedFiles.test.ts similarity index 99% rename from e2e/__tests__/findRelatedFiles.test.js rename to e2e/__tests__/findRelatedFiles.test.ts index 3017a3fa8e35..a5a8e2e686fa 100644 --- a/e2e/__tests__/findRelatedFiles.test.js +++ b/e2e/__tests__/findRelatedFiles.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import os from 'os'; import path from 'path'; -import {cleanup, extractSummary, writeFiles} from '../Utils'; import {wrap} from 'jest-snapshot-serializer-raw'; +import {cleanup, extractSummary, writeFiles} from '../Utils'; +import runJest from '../runJest'; const DIR = path.resolve(os.tmpdir(), 'find-related-tests-test'); diff --git a/e2e/__tests__/focusedTests.test.js b/e2e/__tests__/focusedTests.test.ts similarity index 97% rename from e2e/__tests__/focusedTests.test.js rename to e2e/__tests__/focusedTests.test.ts index e0fe7493b78b..2909d910e92d 100644 --- a/e2e/__tests__/focusedTests.test.js +++ b/e2e/__tests__/focusedTests.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {json} from '../runJest'; diff --git a/e2e/__tests__/forceExit.test.js b/e2e/__tests__/forceExit.test.ts similarity index 99% rename from e2e/__tests__/forceExit.test.js rename to e2e/__tests__/forceExit.test.ts index de0e03ebac1d..423c2517202a 100644 --- a/e2e/__tests__/forceExit.test.js +++ b/e2e/__tests__/forceExit.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import os from 'os'; import path from 'path'; +import runJest from '../runJest'; import {cleanup, writeFiles} from '../Utils'; const DIR = path.resolve(os.tmpdir(), 'force-exit-test'); diff --git a/e2e/__tests__/generatorMock.test.js b/e2e/__tests__/generatorMock.test.ts similarity index 96% rename from e2e/__tests__/generatorMock.test.js rename to e2e/__tests__/generatorMock.test.ts index 2d41feb01991..58a3fb1c7f2c 100644 --- a/e2e/__tests__/generatorMock.test.js +++ b/e2e/__tests__/generatorMock.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/global.test.js b/e2e/__tests__/global.test.ts similarity index 96% rename from e2e/__tests__/global.test.js rename to e2e/__tests__/global.test.ts index b0c1ef4f4069..8e7c61475ca0 100644 --- a/e2e/__tests__/global.test.js +++ b/e2e/__tests__/global.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ test('globals are properly defined', () => { diff --git a/e2e/__tests__/globalSetup.test.js b/e2e/__tests__/globalSetup.test.ts similarity index 99% rename from e2e/__tests__/globalSetup.test.js rename to e2e/__tests__/globalSetup.test.ts index 0c5d82198932..4ed55175c4b2 100644 --- a/e2e/__tests__/globalSetup.test.js +++ b/e2e/__tests__/globalSetup.test.ts @@ -3,7 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ 'use strict'; diff --git a/e2e/__tests__/globalTeardown.test.js b/e2e/__tests__/globalTeardown.test.ts similarity index 99% rename from e2e/__tests__/globalTeardown.test.js rename to e2e/__tests__/globalTeardown.test.ts index 841cef11f179..64690de23c86 100644 --- a/e2e/__tests__/globalTeardown.test.js +++ b/e2e/__tests__/globalTeardown.test.ts @@ -3,14 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ 'use strict'; import fs from 'fs'; -import {createDirectory} from 'jest-util'; import os from 'os'; import path from 'path'; +import {createDirectory} from 'jest-util'; import runJest, {json as runWithJson} from '../runJest'; import {cleanup} from '../Utils'; diff --git a/e2e/__tests__/globals.test.js b/e2e/__tests__/globals.test.ts similarity index 99% rename from e2e/__tests__/globals.test.js rename to e2e/__tests__/globals.test.ts index 63a8566267c8..6dbd056e30e2 100644 --- a/e2e/__tests__/globals.test.js +++ b/e2e/__tests__/globals.test.ts @@ -3,12 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; import os from 'os'; +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import { cleanup, @@ -16,7 +15,6 @@ import { extractSummary, writeFiles, } from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(os.tmpdir(), 'globalVariables.test'); const TEST_DIR = path.resolve(DIR, '__tests__'); diff --git a/e2e/__tests__/hasteMapSha1.test.js b/e2e/__tests__/hasteMapSha1.test.ts similarity index 99% rename from e2e/__tests__/hasteMapSha1.test.js rename to e2e/__tests__/hasteMapSha1.test.ts index b7713d10b6a9..ada94ebbc5b7 100644 --- a/e2e/__tests__/hasteMapSha1.test.js +++ b/e2e/__tests__/hasteMapSha1.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import os from 'os'; diff --git a/e2e/__tests__/hasteMapSize.test.js b/e2e/__tests__/hasteMapSize.test.ts similarity index 99% rename from e2e/__tests__/hasteMapSize.test.js rename to e2e/__tests__/hasteMapSize.test.ts index 32c3ff98dd7c..3f1b328dbc40 100644 --- a/e2e/__tests__/hasteMapSize.test.js +++ b/e2e/__tests__/hasteMapSize.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import os from 'os'; import path from 'path'; import HasteMap from 'jest-haste-map'; -import {cleanup, writeFiles} from '../Utils'; import {sync as realpath} from 'realpath-native'; +import {cleanup, writeFiles} from '../Utils'; const DIR = path.resolve(realpath(os.tmpdir()), 'haste_map_size'); diff --git a/e2e/__tests__/iterator-to-null-test.js b/e2e/__tests__/iterator-to-null-test.ts similarity index 97% rename from e2e/__tests__/iterator-to-null-test.js rename to e2e/__tests__/iterator-to-null-test.ts index af2b518ee66d..228086d284e3 100644 --- a/e2e/__tests__/iterator-to-null-test.js +++ b/e2e/__tests__/iterator-to-null-test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ /* eslint-disable no-extend-native */ diff --git a/e2e/__tests__/jasmineAsync.test.js b/e2e/__tests__/jasmineAsync.test.ts similarity index 99% rename from e2e/__tests__/jasmineAsync.test.js rename to e2e/__tests__/jasmineAsync.test.ts index 9ac1bc50f331..28b4aa827d0d 100644 --- a/e2e/__tests__/jasmineAsync.test.js +++ b/e2e/__tests__/jasmineAsync.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest, {json as runWithJson} from '../runJest'; diff --git a/e2e/__tests__/jasmineAsyncWithPendingDuringTest.js b/e2e/__tests__/jasmineAsyncWithPendingDuringTest.ts similarity index 89% rename from e2e/__tests__/jasmineAsyncWithPendingDuringTest.js rename to e2e/__tests__/jasmineAsyncWithPendingDuringTest.ts index 512935abe4cc..cd9bfc37b89c 100644 --- a/e2e/__tests__/jasmineAsyncWithPendingDuringTest.js +++ b/e2e/__tests__/jasmineAsyncWithPendingDuringTest.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {skipSuiteOnJestCircus} from '@jest/test-utils'; import {json as runWithJson} from '../runJest'; -import {skipSuiteOnJestCircus} from '../../scripts/ConditionalTest'; describe('async jasmine with pending during test', () => { skipSuiteOnJestCircus(); diff --git a/e2e/__tests__/jest.config.js.test.js b/e2e/__tests__/jest.config.js.test.ts similarity index 99% rename from e2e/__tests__/jest.config.js.test.js rename to e2e/__tests__/jest.config.js.test.ts index ccf758c7a79a..e2af200d6343 100644 --- a/e2e/__tests__/jest.config.js.test.js +++ b/e2e/__tests__/jest.config.js.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import {cleanup, extractSummary, writeFiles} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../jest.config.js'); diff --git a/e2e/__tests__/jestChangedFiles.test.js b/e2e/__tests__/jestChangedFiles.test.ts similarity index 99% rename from e2e/__tests__/jestChangedFiles.test.js rename to e2e/__tests__/jestChangedFiles.test.ts index 9736299bb2ac..5cd462fc3937 100644 --- a/e2e/__tests__/jestChangedFiles.test.js +++ b/e2e/__tests__/jestChangedFiles.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import os from 'os'; import path from 'path'; import {wrap} from 'jest-snapshot-serializer-raw'; import {findRepos, getChangedFilesForRoots} from 'jest-changed-files'; -import {skipSuiteOnWindows} from '../../scripts/ConditionalTest'; +import {skipSuiteOnWindows} from '@jest/test-utils'; import {cleanup, run, writeFiles} from '../Utils'; import runJest from '../runJest'; diff --git a/e2e/__tests__/jestRequireActual.test.js b/e2e/__tests__/jestRequireActual.test.ts similarity index 99% rename from e2e/__tests__/jestRequireActual.test.js rename to e2e/__tests__/jestRequireActual.test.ts index 411dced01860..a18030e21f2f 100644 --- a/e2e/__tests__/jestRequireActual.test.js +++ b/e2e/__tests__/jestRequireActual.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/jestRequireMock.test.js b/e2e/__tests__/jestRequireMock.test.ts similarity index 99% rename from e2e/__tests__/jestRequireMock.test.js rename to e2e/__tests__/jestRequireMock.test.ts index d00058e97a78..7981add72c95 100644 --- a/e2e/__tests__/jestRequireMock.test.js +++ b/e2e/__tests__/jestRequireMock.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/json.test.js b/e2e/__tests__/json.test.ts similarity index 97% rename from e2e/__tests__/json.test.js rename to e2e/__tests__/json.test.ts index df3e875203d2..df56cb15d3c3 100644 --- a/e2e/__tests__/json.test.js +++ b/e2e/__tests__/json.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ test('JSON is available in the global scope', () => { diff --git a/e2e/__tests__/jsonReporter.test.js b/e2e/__tests__/jsonReporter.test.ts similarity index 99% rename from e2e/__tests__/jsonReporter.test.js rename to e2e/__tests__/jsonReporter.test.ts index 7fe638ca623a..16d09277599a 100644 --- a/e2e/__tests__/jsonReporter.test.js +++ b/e2e/__tests__/jsonReporter.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; diff --git a/e2e/__tests__/lifecycles.js b/e2e/__tests__/lifecycles.ts similarity index 97% rename from e2e/__tests__/lifecycles.js rename to e2e/__tests__/lifecycles.ts index ea9977021725..75a96cd6ebc6 100644 --- a/e2e/__tests__/lifecycles.js +++ b/e2e/__tests__/lifecycles.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/listTests.test.js b/e2e/__tests__/listTests.test.ts similarity index 99% rename from e2e/__tests__/listTests.test.js rename to e2e/__tests__/listTests.test.ts index f7c4ad6cb7af..34307bdb77a0 100644 --- a/e2e/__tests__/listTests.test.js +++ b/e2e/__tests__/listTests.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import path from 'path'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest from '../runJest'; const testRootDir = path.resolve(__dirname, '..', '..'); diff --git a/e2e/__tests__/locationInResults.test.js b/e2e/__tests__/locationInResults.test.ts similarity index 95% rename from e2e/__tests__/locationInResults.test.js rename to e2e/__tests__/locationInResults.test.ts index 3773f056c520..e444ed7b6830 100644 --- a/e2e/__tests__/locationInResults.test.js +++ b/e2e/__tests__/locationInResults.test.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {isJestCircusRun} from '@jest/test-utils'; import {json as runWithJson} from '../runJest'; -import {isJestCircusRun} from '../../scripts/ConditionalTest'; it('defaults to null for location', () => { const {json: result} = runWithJson('location-in-results'); diff --git a/e2e/__tests__/logHeapUsage.test.js b/e2e/__tests__/logHeapUsage.test.ts similarity index 98% rename from e2e/__tests__/logHeapUsage.test.js rename to e2e/__tests__/logHeapUsage.test.ts index 2367d65ac8e2..a927a73b5b64 100644 --- a/e2e/__tests__/logHeapUsage.test.js +++ b/e2e/__tests__/logHeapUsage.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/mockNames.test.js b/e2e/__tests__/mockNames.test.ts similarity index 99% rename from e2e/__tests__/mockNames.test.js rename to e2e/__tests__/mockNames.test.ts index 40448c16e215..8328fea04a73 100644 --- a/e2e/__tests__/mockNames.test.js +++ b/e2e/__tests__/mockNames.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/moduleNameMapper.test.js b/e2e/__tests__/moduleNameMapper.test.ts similarity index 98% rename from e2e/__tests__/moduleNameMapper.test.js rename to e2e/__tests__/moduleNameMapper.test.ts index e768af3e48bc..a4186a3453f2 100644 --- a/e2e/__tests__/moduleNameMapper.test.js +++ b/e2e/__tests__/moduleNameMapper.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest, {json as runWithJson} from '../runJest'; import {extractSummary} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; test('moduleNameMapper wrong configuration', () => { const {stderr, status} = runJest('module-name-mapper-wrong-config'); diff --git a/e2e/__tests__/moduleParentNullInTest.js b/e2e/__tests__/moduleParentNullInTest.ts similarity index 97% rename from e2e/__tests__/moduleParentNullInTest.js rename to e2e/__tests__/moduleParentNullInTest.ts index 0add10013a19..9b53ef0bd766 100644 --- a/e2e/__tests__/moduleParentNullInTest.js +++ b/e2e/__tests__/moduleParentNullInTest.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/multiProjectRunner.test.js b/e2e/__tests__/multiProjectRunner.test.ts similarity index 99% rename from e2e/__tests__/multiProjectRunner.test.js rename to e2e/__tests__/multiProjectRunner.test.ts index 5850adf05af8..47abab2d968a 100644 --- a/e2e/__tests__/multiProjectRunner.test.js +++ b/e2e/__tests__/multiProjectRunner.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import os from 'os'; import path from 'path'; -import {cleanup, extractSummary, sortLines, writeFiles} from '../Utils'; import {wrap} from 'jest-snapshot-serializer-raw'; +import {cleanup, extractSummary, sortLines, writeFiles} from '../Utils'; +import runJest from '../runJest'; const DIR = path.resolve(os.tmpdir(), 'multi-project-runner-test'); @@ -20,7 +18,7 @@ const SAMPLE_FILE_CONTENT = 'module.exports = {};'; beforeEach(() => cleanup(DIR)); afterEach(() => cleanup(DIR)); -test('--listTests doesnt duplicate the test files', () => { +test("--listTests doesn't duplicate the test files", () => { writeFiles(DIR, { '.watchmanconfig': '', '/project1.js': `module.exports = {rootDir: './', displayName: 'BACKEND'}`, diff --git a/e2e/__tests__/nativeAsyncMock.test.js b/e2e/__tests__/nativeAsyncMock.test.ts similarity index 98% rename from e2e/__tests__/nativeAsyncMock.test.js rename to e2e/__tests__/nativeAsyncMock.test.ts index 2dde843752cd..a7256cf82777 100644 --- a/e2e/__tests__/nativeAsyncMock.test.js +++ b/e2e/__tests__/nativeAsyncMock.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/nestedEventLoop.test.js b/e2e/__tests__/nestedEventLoop.test.ts similarity index 96% rename from e2e/__tests__/nestedEventLoop.test.js rename to e2e/__tests__/nestedEventLoop.test.ts index 25731f2e108a..dd4e386f5212 100644 --- a/e2e/__tests__/nestedEventLoop.test.js +++ b/e2e/__tests__/nestedEventLoop.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/noTestFound.test.js b/e2e/__tests__/noTestFound.test.ts similarity index 98% rename from e2e/__tests__/noTestFound.test.js rename to e2e/__tests__/noTestFound.test.ts index 3d4e0a0bb6e3..4ee75b05c035 100644 --- a/e2e/__tests__/noTestFound.test.js +++ b/e2e/__tests__/noTestFound.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/noTestsFound.test.js b/e2e/__tests__/noTestsFound.test.ts similarity index 99% rename from e2e/__tests__/noTestsFound.test.js rename to e2e/__tests__/noTestsFound.test.ts index 360886aea33d..007a9033d0d6 100644 --- a/e2e/__tests__/noTestsFound.test.js +++ b/e2e/__tests__/noTestsFound.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/nodePath.test.js b/e2e/__tests__/nodePath.test.ts similarity index 82% rename from e2e/__tests__/nodePath.test.js rename to e2e/__tests__/nodePath.test.ts index ee059732a931..7afa0856be26 100644 --- a/e2e/__tests__/nodePath.test.js +++ b/e2e/__tests__/nodePath.test.ts @@ -3,14 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; test('supports NODE_PATH', () => { - // $FlowFixMe after adding @flow to this test this seems to be a real bug const result = runJest('node-path', [], { nodePath: ['../node-path/src'], }); diff --git a/e2e/__tests__/onlyChanged.test.js b/e2e/__tests__/onlyChanged.test.ts similarity index 99% rename from e2e/__tests__/onlyChanged.test.js rename to e2e/__tests__/onlyChanged.test.ts index 1f351e28d81d..1fdcfadd4374 100644 --- a/e2e/__tests__/onlyChanged.test.js +++ b/e2e/__tests__/onlyChanged.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import os from 'os'; import path from 'path'; +import runJest from '../runJest'; import {cleanup, run, writeFiles} from '../Utils'; const DIR = path.resolve(os.tmpdir(), 'jest_only_changed'); diff --git a/e2e/__tests__/overrideGlobals.test.js b/e2e/__tests__/overrideGlobals.test.ts similarity index 98% rename from e2e/__tests__/overrideGlobals.test.js rename to e2e/__tests__/overrideGlobals.test.ts index 32ee2177c7f7..19d3391fea37 100644 --- a/e2e/__tests__/overrideGlobals.test.js +++ b/e2e/__tests__/overrideGlobals.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/presets.test.js b/e2e/__tests__/presets.test.ts similarity index 97% rename from e2e/__tests__/presets.test.js rename to e2e/__tests__/presets.test.ts index 59ddb80556be..60b5596c3d8f 100644 --- a/e2e/__tests__/presets.test.js +++ b/e2e/__tests__/presets.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/processExit.test.js b/e2e/__tests__/processExit.test.ts similarity index 97% rename from e2e/__tests__/processExit.test.js rename to e2e/__tests__/processExit.test.ts index 1290e1b42aa1..a45beb93b370 100644 --- a/e2e/__tests__/processExit.test.js +++ b/e2e/__tests__/processExit.test.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest from '../runJest'; it('prints stack trace pointing to process.exit call', async () => { const {stderr} = await runJest('process-exit'); diff --git a/e2e/__tests__/promiseReject.test.js b/e2e/__tests__/promiseReject.test.ts similarity index 98% rename from e2e/__tests__/promiseReject.test.js rename to e2e/__tests__/promiseReject.test.ts index 1b1b75dce106..d998fd48e77d 100644 --- a/e2e/__tests__/promiseReject.test.js +++ b/e2e/__tests__/promiseReject.test.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import path from 'path'; +import runJest from '../runJest'; import {cleanup, writeFiles} from '../Utils'; const DIR = path.resolve('../promise-reject'); diff --git a/e2e/__tests__/regexCharInPath.test.js b/e2e/__tests__/regexCharInPath.test.ts similarity index 97% rename from e2e/__tests__/regexCharInPath.test.js rename to e2e/__tests__/regexCharInPath.test.ts index cfae71161bca..b6ec5d837cde 100644 --- a/e2e/__tests__/regexCharInPath.test.js +++ b/e2e/__tests__/regexCharInPath.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {json as runWithJson} from '../runJest'; diff --git a/e2e/__tests__/requireAfterTeardown.test.js b/e2e/__tests__/requireAfterTeardown.test.ts similarity index 98% rename from e2e/__tests__/requireAfterTeardown.test.js rename to e2e/__tests__/requireAfterTeardown.test.ts index d47ed9a898bd..4ce1201e337c 100644 --- a/e2e/__tests__/requireAfterTeardown.test.js +++ b/e2e/__tests__/requireAfterTeardown.test.ts @@ -3,12 +3,10 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import runJest from '../runJest'; test('prints useful error for requires after test is done', () => { const {stderr} = runJest('require-after-teardown'); diff --git a/e2e/__tests__/requireMain.test.js b/e2e/__tests__/requireMain.test.ts similarity index 97% rename from e2e/__tests__/requireMain.test.js rename to e2e/__tests__/requireMain.test.ts index 34a95324d07c..361790c0fbbb 100644 --- a/e2e/__tests__/requireMain.test.js +++ b/e2e/__tests__/requireMain.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/requireV8Module.test.js b/e2e/__tests__/requireV8Module.test.ts similarity index 96% rename from e2e/__tests__/requireV8Module.test.js rename to e2e/__tests__/requireV8Module.test.ts index 4344a4a1b3ef..c7072b42308f 100644 --- a/e2e/__tests__/requireV8Module.test.js +++ b/e2e/__tests__/requireV8Module.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ test('v8 module', () => { diff --git a/e2e/__tests__/resetModules.test.js b/e2e/__tests__/resetModules.test.ts similarity index 97% rename from e2e/__tests__/resetModules.test.js rename to e2e/__tests__/resetModules.test.ts index a87314b3e885..8a3e358ee8ae 100644 --- a/e2e/__tests__/resetModules.test.js +++ b/e2e/__tests__/resetModules.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/resolve.test.js b/e2e/__tests__/resolve.test.ts similarity index 96% rename from e2e/__tests__/resolve.test.js rename to e2e/__tests__/resolve.test.ts index a455c02e7045..77e0ab311e5c 100644 --- a/e2e/__tests__/resolve.test.js +++ b/e2e/__tests__/resolve.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/resolveGetPaths.test.js b/e2e/__tests__/resolveGetPaths.test.ts similarity index 96% rename from e2e/__tests__/resolveGetPaths.test.js rename to e2e/__tests__/resolveGetPaths.test.ts index 8afd511abc01..c868c1871d74 100644 --- a/e2e/__tests__/resolveGetPaths.test.js +++ b/e2e/__tests__/resolveGetPaths.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/resolveNoFileExtensions.test.js b/e2e/__tests__/resolveNoFileExtensions.test.ts similarity index 99% rename from e2e/__tests__/resolveNoFileExtensions.test.js rename to e2e/__tests__/resolveNoFileExtensions.test.ts index 535cbb8af7c4..9d50346feb1c 100644 --- a/e2e/__tests__/resolveNoFileExtensions.test.js +++ b/e2e/__tests__/resolveNoFileExtensions.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import {cleanup, extractSummary, writeFiles} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../resolve-no-extensions-no-js'); diff --git a/e2e/__tests__/resolveNodeModule.test.js b/e2e/__tests__/resolveNodeModule.test.ts similarity index 96% rename from e2e/__tests__/resolveNodeModule.test.js rename to e2e/__tests__/resolveNodeModule.test.ts index e5949480c346..40dfcc87ef30 100644 --- a/e2e/__tests__/resolveNodeModule.test.js +++ b/e2e/__tests__/resolveNodeModule.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/resolveWithPaths.test.js b/e2e/__tests__/resolveWithPaths.test.ts similarity index 98% rename from e2e/__tests__/resolveWithPaths.test.js rename to e2e/__tests__/resolveWithPaths.test.ts index ce60bc6b3290..670c05960646 100644 --- a/e2e/__tests__/resolveWithPaths.test.js +++ b/e2e/__tests__/resolveWithPaths.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {resolve} from 'path'; diff --git a/e2e/__tests__/runProgramatically.test.js b/e2e/__tests__/runProgramatically.test.ts similarity index 97% rename from e2e/__tests__/runProgramatically.test.js rename to e2e/__tests__/runProgramatically.test.ts index a9935672f962..5e57c8598414 100644 --- a/e2e/__tests__/runProgramatically.test.js +++ b/e2e/__tests__/runProgramatically.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {resolve} from 'path'; diff --git a/e2e/__tests__/runTestsByPath.test.js b/e2e/__tests__/runTestsByPath.test.ts similarity index 99% rename from e2e/__tests__/runTestsByPath.test.js rename to e2e/__tests__/runTestsByPath.test.ts index 0d487e7e70bf..0a6abe4020d6 100644 --- a/e2e/__tests__/runTestsByPath.test.js +++ b/e2e/__tests__/runTestsByPath.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import os from 'os'; import path from 'path'; +import runJest from '../runJest'; import {cleanup, writeFiles} from '../Utils'; const DIR = path.resolve(os.tmpdir(), 'run-tests-by-path-test'); diff --git a/e2e/__tests__/runtimeInternalModuleRegistry.test.js b/e2e/__tests__/runtimeInternalModuleRegistry.test.ts similarity index 98% rename from e2e/__tests__/runtimeInternalModuleRegistry.test.js rename to e2e/__tests__/runtimeInternalModuleRegistry.test.ts index 91ee8c41ede1..d06b9e7d8d35 100644 --- a/e2e/__tests__/runtimeInternalModuleRegistry.test.js +++ b/e2e/__tests__/runtimeInternalModuleRegistry.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {json as runWithJson} from '../runJest'; diff --git a/e2e/__tests__/setImmediate.test.js b/e2e/__tests__/setImmediate.test.ts similarity index 97% rename from e2e/__tests__/setImmediate.test.js rename to e2e/__tests__/setImmediate.test.ts index 134b886181c1..ea17d5f33682 100644 --- a/e2e/__tests__/setImmediate.test.js +++ b/e2e/__tests__/setImmediate.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/setupFilesAfterEnvConfig.test.js b/e2e/__tests__/setupFilesAfterEnvConfig.test.ts similarity index 99% rename from e2e/__tests__/setupFilesAfterEnvConfig.test.js rename to e2e/__tests__/setupFilesAfterEnvConfig.test.ts index 24f18cbf499d..740bdb2e4ff3 100644 --- a/e2e/__tests__/setupFilesAfterEnvConfig.test.js +++ b/e2e/__tests__/setupFilesAfterEnvConfig.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; diff --git a/e2e/__tests__/showConfig.test.js b/e2e/__tests__/showConfig.test.ts similarity index 94% rename from e2e/__tests__/showConfig.test.js rename to e2e/__tests__/showConfig.test.ts index 5b67d26761d0..927526ea2841 100644 --- a/e2e/__tests__/showConfig.test.js +++ b/e2e/__tests__/showConfig.test.ts @@ -3,16 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; -import runJest from '../runJest'; import os from 'os'; -import {skipSuiteOnWindows} from '../../scripts/ConditionalTest'; -import {cleanup, writeFiles} from '../Utils'; import {wrap} from 'jest-snapshot-serializer-raw'; +import {skipSuiteOnWindows} from '@jest/test-utils'; +import runJest from '../runJest'; +import {cleanup, writeFiles} from '../Utils'; skipSuiteOnWindows(); diff --git a/e2e/__tests__/snapshot.test.js b/e2e/__tests__/snapshot.test.ts similarity index 99% rename from e2e/__tests__/snapshot.test.js rename to e2e/__tests__/snapshot.test.ts index 561916e63faf..59290714ff4b 100644 --- a/e2e/__tests__/snapshot.test.js +++ b/e2e/__tests__/snapshot.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest, {json as runWithJson} from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const emptyTest = 'describe("", () => {it("", () => {})})'; const snapshotDir = path.resolve( diff --git a/e2e/__tests__/snapshotMockFs.test.js b/e2e/__tests__/snapshotMockFs.test.ts similarity index 99% rename from e2e/__tests__/snapshotMockFs.test.js rename to e2e/__tests__/snapshotMockFs.test.ts index 65bc709b75e1..0262482d7289 100644 --- a/e2e/__tests__/snapshotMockFs.test.js +++ b/e2e/__tests__/snapshotMockFs.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/snapshotResolver.test.js b/e2e/__tests__/snapshotResolver.test.ts similarity index 98% rename from e2e/__tests__/snapshotResolver.test.js rename to e2e/__tests__/snapshotResolver.test.ts index cd5fbaaa4cc2..a7be4900874c 100644 --- a/e2e/__tests__/snapshotResolver.test.js +++ b/e2e/__tests__/snapshotResolver.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; diff --git a/e2e/__tests__/snapshotSerializers.test.js b/e2e/__tests__/snapshotSerializers.test.ts similarity index 99% rename from e2e/__tests__/snapshotSerializers.test.js rename to e2e/__tests__/snapshotSerializers.test.ts index 7991000917b3..00748140f7ed 100644 --- a/e2e/__tests__/snapshotSerializers.test.js +++ b/e2e/__tests__/snapshotSerializers.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/stackTrace.test.js b/e2e/__tests__/stackTrace.test.ts similarity index 99% rename from e2e/__tests__/stackTrace.test.js rename to e2e/__tests__/stackTrace.test.ts index 68a06d982101..a65a73883748 100644 --- a/e2e/__tests__/stackTrace.test.js +++ b/e2e/__tests__/stackTrace.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import {extractSummary} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; describe('Stack Trace', () => { it('prints a stack trace for runtime errors', () => { diff --git a/e2e/__tests__/stackTraceNoCaptureStackTrace.test.js b/e2e/__tests__/stackTraceNoCaptureStackTrace.test.ts similarity index 97% rename from e2e/__tests__/stackTraceNoCaptureStackTrace.test.js rename to e2e/__tests__/stackTraceNoCaptureStackTrace.test.ts index 39de7122b30a..a457ff757cb8 100644 --- a/e2e/__tests__/stackTraceNoCaptureStackTrace.test.js +++ b/e2e/__tests__/stackTraceNoCaptureStackTrace.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/stackTraceSourceMaps.test.js b/e2e/__tests__/stackTraceSourceMaps.test.ts similarity index 98% rename from e2e/__tests__/stackTraceSourceMaps.test.js rename to e2e/__tests__/stackTraceSourceMaps.test.ts index 162cabc65085..2502d359415c 100644 --- a/e2e/__tests__/stackTraceSourceMaps.test.js +++ b/e2e/__tests__/stackTraceSourceMaps.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/supportsDashedArgs.js b/e2e/__tests__/supportsDashedArgs.ts similarity index 99% rename from e2e/__tests__/supportsDashedArgs.js rename to e2e/__tests__/supportsDashedArgs.ts index 101d156bbfd0..db6fab3fbf21 100644 --- a/e2e/__tests__/supportsDashedArgs.js +++ b/e2e/__tests__/supportsDashedArgs.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/symbol.test.js b/e2e/__tests__/symbol.test.ts similarity index 96% rename from e2e/__tests__/symbol.test.js rename to e2e/__tests__/symbol.test.ts index 56629c1d89ff..22406c346f61 100644 --- a/e2e/__tests__/symbol.test.js +++ b/e2e/__tests__/symbol.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ test('Symbol deletion', () => { diff --git a/e2e/__tests__/testEnvironment.test.js b/e2e/__tests__/testEnvironment.test.ts similarity index 97% rename from e2e/__tests__/testEnvironment.test.js rename to e2e/__tests__/testEnvironment.test.ts index 239b60efe742..605686aa11e6 100644 --- a/e2e/__tests__/testEnvironment.test.js +++ b/e2e/__tests__/testEnvironment.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {json as runWithJson} from '../runJest'; diff --git a/e2e/__tests__/testEnvironmentAsync.test.js b/e2e/__tests__/testEnvironmentAsync.test.ts similarity index 98% rename from e2e/__tests__/testEnvironmentAsync.test.js rename to e2e/__tests__/testEnvironmentAsync.test.ts index d866e519d96e..f0a1f59bacce 100644 --- a/e2e/__tests__/testEnvironmentAsync.test.js +++ b/e2e/__tests__/testEnvironmentAsync.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; diff --git a/e2e/__tests__/testFailureExitCode.test.js b/e2e/__tests__/testFailureExitCode.test.ts similarity index 98% rename from e2e/__tests__/testFailureExitCode.test.js rename to e2e/__tests__/testFailureExitCode.test.ts index c22ad3061897..30fd47257e2d 100644 --- a/e2e/__tests__/testFailureExitCode.test.js +++ b/e2e/__tests__/testFailureExitCode.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/testInRoot.test.js b/e2e/__tests__/testInRoot.test.ts similarity index 98% rename from e2e/__tests__/testInRoot.test.js rename to e2e/__tests__/testInRoot.test.ts index 1dc86f6e2f4d..246a662fc8f9 100644 --- a/e2e/__tests__/testInRoot.test.js +++ b/e2e/__tests__/testInRoot.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/testNamePattern.test.js b/e2e/__tests__/testNamePattern.test.ts similarity index 98% rename from e2e/__tests__/testNamePattern.test.js rename to e2e/__tests__/testNamePattern.test.ts index bb89cc5a1c13..4162b5443439 100644 --- a/e2e/__tests__/testNamePattern.test.js +++ b/e2e/__tests__/testNamePattern.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import {json as runWithJson} from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; test('testNamePattern', () => { const {stderr, status} = runWithJson('test-name-pattern', [ diff --git a/e2e/__tests__/testNamePatternSkipped.test.js b/e2e/__tests__/testNamePatternSkipped.test.ts similarity index 98% rename from e2e/__tests__/testNamePatternSkipped.test.js rename to e2e/__tests__/testNamePatternSkipped.test.ts index 7dceeede0c81..facd63aa16be 100644 --- a/e2e/__tests__/testNamePatternSkipped.test.js +++ b/e2e/__tests__/testNamePatternSkipped.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ +import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import {json as runWithJson} from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; test('testNamePattern skipped', () => { const {stderr, status} = runWithJson('test-name-pattern-skipped', [ diff --git a/e2e/__tests__/testPathPatternReporterMessage.test.js b/e2e/__tests__/testPathPatternReporterMessage.test.ts similarity index 99% rename from e2e/__tests__/testPathPatternReporterMessage.test.js rename to e2e/__tests__/testPathPatternReporterMessage.test.ts index c09320c21702..bf99a3b127cd 100644 --- a/e2e/__tests__/testPathPatternReporterMessage.test.js +++ b/e2e/__tests__/testPathPatternReporterMessage.test.ts @@ -3,14 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ 'use strict'; -import runJest from '../runJest'; import os from 'os'; import path from 'path'; +import runJest from '../runJest'; import {cleanup, writeFiles} from '../Utils'; const DIR = path.resolve(os.tmpdir(), 'jest-path-pattern-reporter-message'); diff --git a/e2e/__tests__/testResultsProcessor.test.js b/e2e/__tests__/testResultsProcessor.test.ts similarity index 98% rename from e2e/__tests__/testResultsProcessor.test.js rename to e2e/__tests__/testResultsProcessor.test.ts index 5230167a5aee..1055fc2ae915 100644 --- a/e2e/__tests__/testResultsProcessor.test.js +++ b/e2e/__tests__/testResultsProcessor.test.ts @@ -3,7 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ 'use strict'; diff --git a/e2e/__tests__/testRetries.test.js b/e2e/__tests__/testRetries.test.ts similarity index 96% rename from e2e/__tests__/testRetries.test.js rename to e2e/__tests__/testRetries.test.ts index 0a726f5df8f1..6ae9ff75b2d7 100644 --- a/e2e/__tests__/testRetries.test.js +++ b/e2e/__tests__/testRetries.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; import path from 'path'; +import {skipSuiteOnJasmine} from '@jest/test-utils'; import runJest from '../runJest'; -import {skipSuiteOnJasmine} from '../../scripts/ConditionalTest'; skipSuiteOnJasmine(); diff --git a/e2e/__tests__/testTodo.test.js b/e2e/__tests__/testTodo.test.ts similarity index 99% rename from e2e/__tests__/testTodo.test.js rename to e2e/__tests__/testTodo.test.ts index aaedf2b9be23..3f9bc15bd28d 100644 --- a/e2e/__tests__/testTodo.test.js +++ b/e2e/__tests__/testTodo.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; import {extractSummary} from '../Utils'; -import {wrap} from 'jest-snapshot-serializer-raw'; const dir = path.resolve(__dirname, '../test-todo'); test('works with all statuses', () => { diff --git a/e2e/__tests__/timeouts.test.js b/e2e/__tests__/timeouts.test.ts similarity index 99% rename from e2e/__tests__/timeouts.test.js rename to e2e/__tests__/timeouts.test.ts index 14a8f609d759..09d38e6e9d1b 100644 --- a/e2e/__tests__/timeouts.test.js +++ b/e2e/__tests__/timeouts.test.ts @@ -3,15 +3,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ 'use strict'; import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../timeouts'); diff --git a/e2e/__tests__/timeoutsLegacy.test.js b/e2e/__tests__/timeoutsLegacy.test.ts similarity index 96% rename from e2e/__tests__/timeoutsLegacy.test.js rename to e2e/__tests__/timeoutsLegacy.test.ts index d5fe3e816f0f..7ac9a0c7731c 100644 --- a/e2e/__tests__/timeoutsLegacy.test.js +++ b/e2e/__tests__/timeoutsLegacy.test.ts @@ -3,16 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * @flow */ -'use strict'; - import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; +import {skipSuiteOnJestCircus} from '@jest/test-utils'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {skipSuiteOnJestCircus} from '../../scripts/ConditionalTest'; -import {wrap} from 'jest-snapshot-serializer-raw'; /** * NOTE: This test should be removed once jest-circus is rolled out as a breaking change. diff --git a/e2e/__tests__/timerResetMocks.test.js b/e2e/__tests__/timerResetMocks.test.ts similarity index 97% rename from e2e/__tests__/timerResetMocks.test.js rename to e2e/__tests__/timerResetMocks.test.ts index 8b0a0ec4608d..194c9cd4045a 100644 --- a/e2e/__tests__/timerResetMocks.test.js +++ b/e2e/__tests__/timerResetMocks.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/timerUseRealTimers.test.js b/e2e/__tests__/timerUseRealTimers.test.ts similarity index 97% rename from e2e/__tests__/timerUseRealTimers.test.js rename to e2e/__tests__/timerUseRealTimers.test.ts index b1fe0f7bbe2d..8a655ed32606 100644 --- a/e2e/__tests__/timerUseRealTimers.test.js +++ b/e2e/__tests__/timerUseRealTimers.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/toMatchInlineSnapshot.test.js b/e2e/__tests__/toMatchInlineSnapshot.test.ts similarity index 99% rename from e2e/__tests__/toMatchInlineSnapshot.test.js rename to e2e/__tests__/toMatchInlineSnapshot.test.ts index 41c7e42bc283..034b928d508d 100644 --- a/e2e/__tests__/toMatchInlineSnapshot.test.js +++ b/e2e/__tests__/toMatchInlineSnapshot.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import fs from 'fs'; import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../to-match-inline-snapshot'); const TESTS_DIR = path.resolve(DIR, '__tests__'); diff --git a/e2e/__tests__/toMatchSnapshot.test.js b/e2e/__tests__/toMatchSnapshot.test.ts similarity index 99% rename from e2e/__tests__/toMatchSnapshot.test.js rename to e2e/__tests__/toMatchSnapshot.test.ts index 5fd065d03259..2f9cdc115a45 100644 --- a/e2e/__tests__/toMatchSnapshot.test.js +++ b/e2e/__tests__/toMatchSnapshot.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.js b/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.ts similarity index 99% rename from e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.js rename to e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.ts index 75013e055a00..5c69136a6ca9 100644 --- a/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.js +++ b/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; import fs from 'fs'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve( __dirname, diff --git a/e2e/__tests__/toThrowErrorMatchingSnapshot.test.js b/e2e/__tests__/toThrowErrorMatchingSnapshot.test.ts similarity index 99% rename from e2e/__tests__/toThrowErrorMatchingSnapshot.test.js rename to e2e/__tests__/toThrowErrorMatchingSnapshot.test.ts index 626069f54857..bd2ea58d67a5 100644 --- a/e2e/__tests__/toThrowErrorMatchingSnapshot.test.js +++ b/e2e/__tests__/toThrowErrorMatchingSnapshot.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; import fs from 'fs'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; const DIR = path.resolve(__dirname, '../to-throw-error-matching-snapshot'); const TESTS_DIR = path.resolve(DIR, '__tests__'); diff --git a/e2e/__tests__/transform.test.js b/e2e/__tests__/transform.test.ts similarity index 99% rename from e2e/__tests__/transform.test.js rename to e2e/__tests__/transform.test.ts index 8adc624a0249..9bb9fea5efd0 100644 --- a/e2e/__tests__/transform.test.js +++ b/e2e/__tests__/transform.test.ts @@ -3,11 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import os from 'os'; +import {wrap} from 'jest-snapshot-serializer-raw'; import { cleanup, copyDir, @@ -17,8 +17,6 @@ import { run, } from '../Utils'; import runJest, {json as runWithJson} from '../runJest'; -import os from 'os'; -import {wrap} from 'jest-snapshot-serializer-raw'; describe('babel-jest', () => { const dir = path.resolve(__dirname, '..', 'transform/babel-jest'); diff --git a/e2e/__tests__/transformLinkedModules.test.js b/e2e/__tests__/transformLinkedModules.test.ts similarity index 97% rename from e2e/__tests__/transformLinkedModules.test.js rename to e2e/__tests__/transformLinkedModules.test.ts index 3866b1411c35..cfda29af1ff4 100644 --- a/e2e/__tests__/transformLinkedModules.test.js +++ b/e2e/__tests__/transformLinkedModules.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import {json as runWithJson} from '../runJest'; diff --git a/e2e/__tests__/typescriptCoverage.test.js b/e2e/__tests__/typescriptCoverage.test.ts similarity index 98% rename from e2e/__tests__/typescriptCoverage.test.js rename to e2e/__tests__/typescriptCoverage.test.ts index 5c13681302fe..fedbe25d74ab 100644 --- a/e2e/__tests__/typescriptCoverage.test.js +++ b/e2e/__tests__/typescriptCoverage.test.ts @@ -3,14 +3,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; +import {wrap} from 'jest-snapshot-serializer-raw'; import {run} from '../Utils'; import runJest from '../runJest'; -import {wrap} from 'jest-snapshot-serializer-raw'; it('instruments and collects coverage for typescript files', () => { const dir = path.resolve(__dirname, '../typescript-coverage'); diff --git a/e2e/__tests__/unexpectedToken.test.js b/e2e/__tests__/unexpectedToken.test.ts similarity index 99% rename from e2e/__tests__/unexpectedToken.test.js rename to e2e/__tests__/unexpectedToken.test.ts index 7bf053296c97..fdca50aa60b6 100644 --- a/e2e/__tests__/unexpectedToken.test.js +++ b/e2e/__tests__/unexpectedToken.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import os from 'os'; import path from 'path'; +import runJest from '../runJest'; import {cleanup, writeFiles} from '../Utils'; const DIR = path.resolve(os.tmpdir(), 'unexpected-token'); diff --git a/e2e/__tests__/useStderr.test.js b/e2e/__tests__/useStderr.test.ts similarity index 98% rename from e2e/__tests__/useStderr.test.js rename to e2e/__tests__/useStderr.test.ts index d741fe5317da..8447ecb5b780 100644 --- a/e2e/__tests__/useStderr.test.js +++ b/e2e/__tests__/useStderr.test.ts @@ -3,13 +3,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ -import runJest from '../runJest'; import os from 'os'; import path from 'path'; +import runJest from '../runJest'; import {cleanup, writeFiles} from '../Utils'; const DIR = path.resolve(os.tmpdir(), 'use-stderr-test'); diff --git a/e2e/__tests__/verbose.test.js b/e2e/__tests__/verbose.test.ts similarity index 97% rename from e2e/__tests__/verbose.test.js rename to e2e/__tests__/verbose.test.ts index 5ad4d428b312..241d6ebbf1ec 100644 --- a/e2e/__tests__/verbose.test.js +++ b/e2e/__tests__/verbose.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import runJest from '../runJest'; diff --git a/e2e/__tests__/version.test.js b/e2e/__tests__/version.test.ts similarity index 98% rename from e2e/__tests__/version.test.js rename to e2e/__tests__/version.test.ts index 5fbe936a7464..5874a8733a36 100644 --- a/e2e/__tests__/version.test.js +++ b/e2e/__tests__/version.test.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; diff --git a/e2e/__tests__/watchModeOnlyFailed.test.js b/e2e/__tests__/watchModeOnlyFailed.test.ts similarity index 99% rename from e2e/__tests__/watchModeOnlyFailed.test.js rename to e2e/__tests__/watchModeOnlyFailed.test.ts index fea5a4165872..93b89564d9d5 100644 --- a/e2e/__tests__/watchModeOnlyFailed.test.js +++ b/e2e/__tests__/watchModeOnlyFailed.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; -import {cleanup, extractSummaries, writeFiles} from '../Utils'; import os from 'os'; -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import {cleanup, extractSummaries, writeFiles} from '../Utils'; +import runJest from '../runJest'; const DIR = path.resolve(os.tmpdir(), 'watch-mode-only-failed'); const pluginPath = path.resolve(__dirname, '../MockStdinWatchPlugin'); diff --git a/e2e/__tests__/watchModePatterns.test.js b/e2e/__tests__/watchModePatterns.test.ts similarity index 99% rename from e2e/__tests__/watchModePatterns.test.js rename to e2e/__tests__/watchModePatterns.test.ts index d21e26cda6e6..888bc75bffc7 100644 --- a/e2e/__tests__/watchModePatterns.test.js +++ b/e2e/__tests__/watchModePatterns.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; -import {cleanup, extractSummaries, writeFiles} from '../Utils'; import os from 'os'; -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import {cleanup, extractSummaries, writeFiles} from '../Utils'; +import runJest from '../runJest'; const DIR = path.resolve(os.tmpdir(), 'watch-mode-patterns'); const pluginPath = path.resolve(__dirname, '../MockStdinWatchPlugin'); diff --git a/e2e/__tests__/watchModeUpdateSnapshot.test.js b/e2e/__tests__/watchModeUpdateSnapshot.test.ts similarity index 99% rename from e2e/__tests__/watchModeUpdateSnapshot.test.js rename to e2e/__tests__/watchModeUpdateSnapshot.test.ts index 21bd3ba32b27..6b80c432a82a 100644 --- a/e2e/__tests__/watchModeUpdateSnapshot.test.js +++ b/e2e/__tests__/watchModeUpdateSnapshot.test.ts @@ -3,15 +3,13 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ import path from 'path'; -import {cleanup, extractSummaries, writeFiles} from '../Utils'; import os from 'os'; -import runJest from '../runJest'; import {wrap} from 'jest-snapshot-serializer-raw'; +import {cleanup, extractSummaries, writeFiles} from '../Utils'; +import runJest from '../runJest'; const DIR = path.resolve(os.tmpdir(), 'watch-mode-update-snapshot'); const pluginPath = path.resolve(__dirname, '../MockStdinWatchPlugin'); diff --git a/e2e/runJest.js b/e2e/runJest.ts similarity index 76% rename from e2e/runJest.js rename to e2e/runJest.ts index ce6a9f8ba943..8e6f615eeacf 100644 --- a/e2e/runJest.js +++ b/e2e/runJest.ts @@ -4,13 +4,11 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow */ -'use strict'; import path from 'path'; import fs from 'fs'; -import execa from 'execa'; +import execa, {ExecaChildProcess, ExecaReturns} from 'execa'; import {Writable} from 'readable-stream'; import stripAnsi from 'strip-ansi'; import {normalizeIcons} from './Utils'; @@ -18,10 +16,10 @@ import {normalizeIcons} from './Utils'; const JEST_PATH = path.resolve(__dirname, '../packages/jest-cli/bin/jest.js'); type RunJestOptions = { - nodePath?: string, - skipPkgJsonCheck?: boolean, // don't complain if can't find package.json - stripAnsi?: boolean, // remove colors from stdout and stderr, - timeout?: number, // kill the Jest process after X milliseconds + nodePath?: string; + skipPkgJsonCheck?: boolean; // don't complain if can't find package.json + stripAnsi?: boolean; // remove colors from stdout and stderr, + timeout?: number; // kill the Jest process after X milliseconds }; // return the result of the spawned process: @@ -35,13 +33,26 @@ export default function runJest( return normalizeResult(spawnJest(dir, args, options), options); } +function spawnJest( + dir: string, + args?: Array, + options?: RunJestOptions, + spawnAsync?: false, +): ExecaReturns; +function spawnJest( + dir: string, + args?: Array, + options?: RunJestOptions, + spawnAsync?: true, +): ExecaChildProcess; + // Spawns Jest and returns either a Promise (if spawnAsync is true) or the completed child process function spawnJest( dir: string, args?: Array, options: RunJestOptions = {}, spawnAsync: boolean = false, -) { +): ExecaReturns | ExecaChildProcess { const isRelative = !path.isAbsolute(dir); if (isRelative) { @@ -59,8 +70,8 @@ function spawnJest( `, ); } + const env = Object.assign({}, process.env, {FORCE_COLOR: '0'}); - const env = {...process.env, FORCE_COLOR: 0}; if (options.nodePath) env['NODE_PATH'] = options.nodePath; const spawnArgs = [JEST_PATH, ...(args || [])]; @@ -78,7 +89,17 @@ function spawnJest( ); } -function normalizeResult(result, options) { +type RunJestResult = ExecaReturns & { + status?: number; + code?: number; + json?: ( + dir: string, + args: Array | undefined, + options: RunJestOptions, + ) => RunJestResult; +}; + +function normalizeResult(result: RunJestResult, options: RunJestOptions) { // For compat with cross-spawn result.status = result.code; @@ -96,13 +117,13 @@ function normalizeResult(result, options) { // 'numPendingTests', 'testResults' export const json = function( dir: string, - args?: Array, + args: Array | undefined, options: RunJestOptions = {}, -) { +): RunJestResult { args = [...(args || []), '--json']; const result = runJest(dir, args, options); try { - result.json = JSON.parse((result.stdout || '').toString()); + result.json = JSON.parse(result.stdout || ''); } catch (e) { throw new Error( ` @@ -119,7 +140,7 @@ export const json = function( // Runs `jest` until a given output is achieved, then kills it with `SIGTERM` export const until = async function( dir: string, - args?: Array, + args: Array | undefined, text: string, options: RunJestOptions = {}, ) { @@ -127,7 +148,7 @@ export const until = async function( jestPromise.stderr.pipe( new Writable({ - write(chunk, encoding, callback) { + write(chunk, _encoding, callback) { const output = chunk.toString('utf8'); if (output.includes(text)) { diff --git a/jest.config.js b/jest.config.js index 81f208271834..1d4488d6904d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -54,7 +54,7 @@ module.exports = { '/packages/jest-validate/src/__tests__/fixtures/', '/packages/jest-worker/src/__performance_tests__', '/packages/pretty-format/perf/test.js', - '/e2e/__tests__/iterator-to-null-test.js', + '/e2e/__tests__/iterator-to-null-test.ts', ], transform: { '^.+\\.[jt]sx?$': '/packages/babel-jest', diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index d137fb0d5273..f946c2a14f49 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -28,6 +28,7 @@ "throat": "^4.0.0" }, "devDependencies": { + "@jest/test-utils": "0.0.0", "@types/babel__traverse": "^7.0.4", "@types/co": "^4.6.0", "@types/stack-utils": "^1.0.1", diff --git a/packages/jest-circus/src/__mocks__/testUtils.ts b/packages/jest-circus/src/__mocks__/testUtils.ts index 6a53bb586938..1865256a50b7 100644 --- a/packages/jest-circus/src/__mocks__/testUtils.ts +++ b/packages/jest-circus/src/__mocks__/testUtils.ts @@ -12,7 +12,7 @@ import path from 'path'; import crypto from 'crypto'; import {sync as spawnSync, ExecaReturns} from 'execa'; // @ts-ignore -import {skipSuiteOnWindows} from '../../../../scripts/ConditionalTest'; +import {skipSuiteOnWindows} from '@jest/test-utils'; const CIRCUS_PATH = require.resolve('../../build'); const CIRCUS_RUN_PATH = require.resolve('../../build/run'); diff --git a/packages/jest-haste-map/src/__tests__/index.test.js b/packages/jest-haste-map/src/__tests__/index.test.js index c11a752bd8b9..e200fb612b6b 100644 --- a/packages/jest-haste-map/src/__tests__/index.test.js +++ b/packages/jest-haste-map/src/__tests__/index.test.js @@ -7,7 +7,7 @@ */ import crypto from 'crypto'; -import {skipSuiteOnWindows} from '../../../../scripts/ConditionalTest'; +import {skipSuiteOnWindows} from '@jest/test-utils'; function mockHashContents(contents) { return crypto diff --git a/packages/jest-haste-map/src/__tests__/worker.test.js b/packages/jest-haste-map/src/__tests__/worker.test.js index 7654912eb336..a6bf021571c7 100644 --- a/packages/jest-haste-map/src/__tests__/worker.test.js +++ b/packages/jest-haste-map/src/__tests__/worker.test.js @@ -10,7 +10,7 @@ import path from 'path'; import fs from 'graceful-fs'; -import {skipSuiteOnWindows} from '../../../../scripts/ConditionalTest'; +import {skipSuiteOnWindows} from '@jest/test-utils'; import H from '../constants'; diff --git a/packages/jest-haste-map/src/crawlers/__tests__/node.test.js b/packages/jest-haste-map/src/crawlers/__tests__/node.test.js index c8e992586c3b..167cc0783d53 100644 --- a/packages/jest-haste-map/src/crawlers/__tests__/node.test.js +++ b/packages/jest-haste-map/src/crawlers/__tests__/node.test.js @@ -8,7 +8,7 @@ 'use strict'; -import {skipSuiteOnWindows} from '../../../../../scripts/ConditionalTest'; +import {skipSuiteOnWindows} from '@jest/test-utils'; jest.mock('child_process', () => ({ spawn: jest.fn((cmd, args) => { diff --git a/packages/jest-repl/src/__tests__/jest_repl.test.js b/packages/jest-repl/src/__tests__/jest_repl.test.js index 94848642f06c..4a6d23fb5bf6 100644 --- a/packages/jest-repl/src/__tests__/jest_repl.test.js +++ b/packages/jest-repl/src/__tests__/jest_repl.test.js @@ -9,7 +9,7 @@ import {spawnSync} from 'child_process'; import path from 'path'; -import {skipSuiteOnWindows} from '../../../../scripts/ConditionalTest'; +import {skipSuiteOnWindows} from '@jest/test-utils'; const JEST_RUNTIME = path.resolve(__dirname, '../../bin/jest-repl.js'); diff --git a/packages/jest-runtime/src/__tests__/runtime_cli.test.js b/packages/jest-runtime/src/__tests__/runtime_cli.test.js index 10427717e931..8fb96c442b62 100644 --- a/packages/jest-runtime/src/__tests__/runtime_cli.test.js +++ b/packages/jest-runtime/src/__tests__/runtime_cli.test.js @@ -6,11 +6,10 @@ * * @flow */ -'use strict'; import path from 'path'; import {sync as spawnSync} from 'execa'; -import {skipSuiteOnWindows} from '../../../../scripts/ConditionalTest'; +import {skipSuiteOnWindows} from '@jest/test-utils'; skipSuiteOnWindows(); diff --git a/packages/test-utils/README.md b/packages/test-utils/README.md new file mode 100644 index 000000000000..f9003764d794 --- /dev/null +++ b/packages/test-utils/README.md @@ -0,0 +1,25 @@ +# babel-jest + +[Babel](https://github.com/babel/babel) [jest](https://github.com/facebook/jest) plugin + +## Usage + +If you are already using `jest-cli`, just add `babel-jest` and it will automatically compile JavaScript code using Babel. + +```bash +yarn add --dev babel-jest @babel/core +``` + +If you would like to write your own preprocessor, uninstall and delete babel-jest and set the [config.transform](https://jestjs.io/docs/configuration#transform-object-string-string) option to your preprocessor. + +## Setup + +_Note: this step is only required if you are using `babel-jest` with additional code preprocessors._ + +To explicitly define `babel-jest` as a transformer for your JavaScript code, map _.js_ files to the `babel-jest` module. + +```json +"transform": { + "^.+\\.jsx?$": "babel-jest" +}, +``` diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json new file mode 100644 index 000000000000..709c2004a42a --- /dev/null +++ b/packages/test-utils/package.json @@ -0,0 +1,8 @@ +{ + "name": "@jest/test-utils", + "version": "0.0.0", + "private": true, + "license": "MIT", + "main": "build/index.js", + "types": "src/index.d.ts" +} diff --git a/scripts/ConditionalTest.js b/packages/test-utils/src/ConditionalTest.ts similarity index 98% rename from scripts/ConditionalTest.js rename to packages/test-utils/src/ConditionalTest.ts index 9906461889c3..da7afd008bc6 100644 --- a/scripts/ConditionalTest.js +++ b/packages/test-utils/src/ConditionalTest.ts @@ -3,8 +3,6 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @flow */ /* eslint-disable jest/no-focused-tests */ diff --git a/packages/test-utils/src/index.ts b/packages/test-utils/src/index.ts new file mode 100644 index 000000000000..d262ec646730 --- /dev/null +++ b/packages/test-utils/src/index.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +export { + isJestCircusRun, + skipSuiteOnJasmine, + skipSuiteOnJestCircus, + skipSuiteOnWindows, +} from './ConditionalTest'; diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json new file mode 100644 index 000000000000..3046cb6b9b6a --- /dev/null +++ b/packages/test-utils/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build" + }, + "references": [{"path": "../jest-types"}] +}