Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: export default in test environments #11335

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ Example:

```js
// my-custom-environment
const NodeEnvironment = require('jest-environment-node');
const NodeEnvironment = require('jest-environment-node').default;

class CustomEnvironment extends NodeEnvironment {
constructor(config, context) {
Expand Down
2 changes: 1 addition & 1 deletion docs/Puppeteer.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const fs = require('fs');
const os = require('os');
const path = require('path');
const puppeteer = require('puppeteer');
const NodeEnvironment = require('jest-environment-node');
const NodeEnvironment = require('jest-environment-node').default;

const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');

Expand Down
2 changes: 1 addition & 1 deletion e2e/test-environment-async/TestEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

const fs = require('fs');
const os = require('os');
const JSDOMEnvironment = require('jest-environment-jsdom');
const JSDOMEnvironment = require('jest-environment-jsdom').default;
const {createDirectory} = require('jest-util');

const DIR = os.tmpdir() + '/jest-test-environment';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

'use strict';

const JSDOMEnvironment = require('jest-environment-jsdom');
const JSDOMEnvironment = require('jest-environment-jsdom').default;

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

'use strict';

const JSDOMEnvironment = require('jest-environment-jsdom');
const JSDOMEnvironment = require('jest-environment-jsdom').default;

class TestEnvironment extends JSDOMEnvironment {
handleTestEvent(event) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/test-environment/DocblockPragmasEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

'use strict';

const JSDOMEnvironment = require('jest-environment-jsdom');
const JSDOMEnvironment = require('jest-environment-jsdom').default;

class TestEnvironment extends JSDOMEnvironment {
constructor(config, context) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/test-environment/EsmDefaultEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

exports.__esModule = true;

const NodeEnvironment = require('jest-environment-node');
const NodeEnvironment = require('jest-environment-node').default;

class Env extends NodeEnvironment {
constructor(config, options) {
Expand Down
2 changes: 1 addition & 1 deletion examples/mongodb/mongo-environment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// mongo-environment.js
const NodeEnvironment = require('jest-environment-node');
const NodeEnvironment = require('jest-environment-node').default;

const path = require('path');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {makeProjectConfig} from '@jest/test-utils';
import JSDomEnvironment = require('../');
import JSDomEnvironment from '../';

describe('JSDomEnvironment', () => {
it('should configure setTimeout/setInterval to use the browser api', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-environment-jsdom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ class JSDOMEnvironment implements JestEnvironment {
}
}

export = JSDOMEnvironment;
export default JSDOMEnvironment;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {makeProjectConfig} from '@jest/test-utils';
import NodeEnvironment = require('../');
import NodeEnvironment from '../';

const isTextEncoderDefined = typeof TextEncoder === 'function';

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-environment-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ class NodeEnvironment implements JestEnvironment {
}
}

export = NodeEnvironment;
export default NodeEnvironment;