Skip to content

Commit

Permalink
chore: reduce reliance on esModuleInterop (#8842)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Aug 18, 2019
1 parent d69f8d3 commit 0e5b363
Show file tree
Hide file tree
Showing 168 changed files with 522 additions and 607 deletions.
4 changes: 2 additions & 2 deletions e2e/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*
*/

import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import {Config} from '@jest/types';

import {sync as spawnSync, ExecaReturns} from 'execa';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ FAIL __tests__/index.js
12 | module.exports = () => 'test';
13 |
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:501:17)
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:493:17)
at Object.require (index.js:10:1)
`;
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ FAIL __tests__/test.js
| ^
9 |
at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:259:17)
at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:255:17)
at Object.require (index.js:8:18)
`;
2 changes: 1 addition & 1 deletion e2e/__tests__/__snapshots__/transform.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FAIL __tests__/ignoredFile.test.js
babel-jest: Babel ignores __tests__/ignoredFile.test.js - make sure to include the file in Jest's transformIgnorePatterns as well.
at loadBabelConfig (../../../packages/babel-jest/build/index.js:132:13)
at loadBabelConfig (../../../packages/babel-jest/build/index.js:157:13)
`;

exports[`babel-jest instruments only specific files and collects coverage 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/asyncRegenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {run} from '../Utils';
import {json as runWithJson} from '../runJest';

Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/babelPluginJestHoist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {json as runWithJson} from '../runJest';
import {run} from '../Utils';

Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/chaiAssertionLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import runJest from '../runJest';
import {extractSummary, run} from '../Utils';
Expand Down
8 changes: 4 additions & 4 deletions e2e/__tests__/clearCache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

import fs from 'fs';
import os from 'os';
import path from 'path';
import * as fs from 'fs';
import {tmpdir} from 'os';
import * as path from 'path';
import runJest from '../runJest';

const CACHE = path.resolve(os.tmpdir(), 'clear-cache-directory');
const CACHE = path.resolve(tmpdir(), 'clear-cache-directory');

describe('jest --clearCache', () => {
test('normal run results in cache directory being written', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/cliHandlesExactFilenames.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {skipSuiteOnWindows} from '@jest/test-utils';
import {cleanup, extractSummary, writeFiles} from '../Utils';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/console.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {extractSummary, run} from '../Utils';
import runJest from '../runJest';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {cleanup, extractSummary, writeFiles} from '../Utils';
import runJest from '../runJest';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/coverageRemapping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {readFileSync} from 'fs';
import path from 'path';
import * as path from 'path';
import {cleanup, run} from '../Utils';
import runJest from '../runJest';

Expand Down
4 changes: 2 additions & 2 deletions e2e/__tests__/coverageReport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {extractSummary, run} from '../Utils';
import runJest from '../runJest';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/coverageThreshold.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {cleanup, extractSummary, writeFiles} from '../Utils';
import runJest from '../runJest';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/coverageTransformInstrumented.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {readFileSync} from 'fs';
import path from 'path';
import * as path from 'path';
import {cleanup, run} from '../Utils';
import runJest from '../runJest';

Expand Down
6 changes: 3 additions & 3 deletions e2e/__tests__/customReporters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/

import os from 'os';
import path from 'path';
import {tmpdir} from 'os';
import * as 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');
const DIR = path.resolve(tmpdir(), 'custom-reporters-test-dir');

beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/customTestSequencers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import runJest from '../runJest';
import {extractSummary} from '../Utils';
const dir = path.resolve(__dirname, '../custom-test-sequencer');
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/debug.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import runJest from '../runJest';

describe('jest --debug', () => {
Expand Down
6 changes: 3 additions & 3 deletions e2e/__tests__/dependencyClash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import os from 'os';
import * as path from 'path';
import {tmpdir} from 'os';
import {skipSuiteOnWindows} from '@jest/test-utils';
import {cleanup, createEmptyPackage, writeFiles} from '../Utils';
import runJest from '../runJest';

skipSuiteOnWindows();

// doing test in a temp directory because we don't want jest node_modules affect it
const tempDir = path.resolve(os.tmpdir(), 'clashing-dependencies-test');
const tempDir = path.resolve(tmpdir(), 'clashing-dependencies-test');
const hasteImplModulePath = path.resolve(
'./packages/jest-haste-map/src/__tests__/haste_impl.js',
);
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/deprecatedCliOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import runJest from '../runJest';

const dir = path.resolve(__dirname, '../deprecated-cli-options');
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/each.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import runJest from '../runJest';
import {extractSummary} from '../Utils';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/emptyDescribeWithHooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {skipSuiteOnJasmine} from '@jest/test-utils';
import runJest from '../runJest';
import {extractSummary} from '../Utils';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/emptySuiteError.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

'use strict';

import path from 'path';
import * as path from 'path';
import runJest from '../runJest';

const DIR = path.resolve(__dirname, '../empty-suite-error');
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/executeTestsOnceInMpr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {cleanup, extractSummary, writeFiles} from '../Utils';
import runJest from '../runJest';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/expectAsyncMatcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import runJest from '../runJest';
import {extractSummary, run} from '../Utils';
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/failures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {extractSummary, run} from '../Utils';
import runJest from '../runJest';
Expand Down
6 changes: 3 additions & 3 deletions e2e/__tests__/fatalWorkerError.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import os from 'os';
import * as path from 'path';
import {tmpdir} from 'os';
import {cleanup, writeFiles} from '../Utils';
import runJest from '../runJest';

const DIR = path.resolve(os.tmpdir(), 'fatal-worker-error');
const DIR = path.resolve(tmpdir(), 'fatal-worker-error');

beforeEach(() => cleanup(DIR));
afterAll(() => cleanup(DIR));
Expand Down
6 changes: 3 additions & 3 deletions e2e/__tests__/findRelatedFiles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/

import os from 'os';
import path from 'path';
import {tmpdir} from 'os';
import * as path from 'path';
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');
const DIR = path.resolve(tmpdir(), 'find-related-tests-test');

beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));
Expand Down
6 changes: 3 additions & 3 deletions e2e/__tests__/forceExit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

import os from 'os';
import path from 'path';
import {tmpdir} from 'os';
import * as path from 'path';
import runJest from '../runJest';
import {cleanup, writeFiles} from '../Utils';

const DIR = path.resolve(os.tmpdir(), 'force-exit-test');
const DIR = path.resolve(tmpdir(), 'force-exit-test');

beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));
Expand Down
16 changes: 8 additions & 8 deletions e2e/__tests__/globalSetup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
*/
'use strict';

import fs from 'fs';
import os from 'os';
import path from 'path';
import * as fs from 'fs';
import {tmpdir} from 'os';
import * as path from 'path';
import runJest, {json as runWithJson} from '../runJest';
import {cleanup, run} from '../Utils';

const DIR = path.join(os.tmpdir(), 'jest-global-setup');
const project1DIR = path.join(os.tmpdir(), 'jest-global-setup-project-1');
const project2DIR = path.join(os.tmpdir(), 'jest-global-setup-project-2');
const DIR = path.join(tmpdir(), 'jest-global-setup');
const project1DIR = path.join(tmpdir(), 'jest-global-setup-project-1');
const project2DIR = path.join(tmpdir(), 'jest-global-setup-project-2');
const customTransformDIR = path.join(
os.tmpdir(),
tmpdir(),
'jest-global-setup-custom-transform',
);
const nodeModulesDIR = path.join(os.tmpdir(), 'jest-global-setup-node-modules');
const nodeModulesDIR = path.join(tmpdir(), 'jest-global-setup-node-modules');
const e2eDir = path.resolve(__dirname, '../global-setup');

beforeAll(() => {
Expand Down
12 changes: 6 additions & 6 deletions e2e/__tests__/globalTeardown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
*/
'use strict';

import fs from 'fs';
import os from 'os';
import path from 'path';
import * as fs from 'fs';
import {tmpdir} from 'os';
import * as path from 'path';
import {createDirectory} from 'jest-util';
import runJest, {json as runWithJson} from '../runJest';
import {cleanup, run} from '../Utils';

const DIR = path.join(os.tmpdir(), 'jest-global-teardown');
const project1DIR = path.join(os.tmpdir(), 'jest-global-teardown-project-1');
const project2DIR = path.join(os.tmpdir(), 'jest-global-teardown-project-2');
const DIR = path.join(tmpdir(), 'jest-global-teardown');
const project1DIR = path.join(tmpdir(), 'jest-global-teardown-project-1');
const project2DIR = path.join(tmpdir(), 'jest-global-teardown-project-2');
const e2eDir = path.resolve(__dirname, '../global-teardown');

beforeAll(() => {
Expand Down
6 changes: 3 additions & 3 deletions e2e/__tests__/globals.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import os from 'os';
import * as path from 'path';
import {tmpdir} from 'os';
import {wrap} from 'jest-snapshot-serializer-raw';
import runJest from '../runJest';
import {
Expand All @@ -16,7 +16,7 @@ import {
writeFiles,
} from '../Utils';

const DIR = path.resolve(os.tmpdir(), 'globalVariables.test');
const DIR = path.resolve(tmpdir(), 'globalVariables.test');
const TEST_DIR = path.resolve(DIR, '__tests__');

function cleanStderr(stderr) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/hasteMapMockChanged.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import * as path from 'path';
import JestHasteMap from 'jest-haste-map';
import {cleanup, writeFiles} from '../Utils';

Expand Down
Loading

0 comments on commit 0e5b363

Please sign in to comment.