jest-environment-jsdom 28.0.0 → 28.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -23,6 +23,7 @@ declare class JSDOMEnvironment implements JestEnvironment<number> {
23
23
  global: Win;
24
24
  private errorEventListener;
25
25
  moduleMocker: ModuleMocker | null;
26
+ customExportConditions: string[];
26
27
  constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
27
28
  setup(): Promise<void>;
28
29
  teardown(): Promise<void>;
package/build/index.js CHANGED
@@ -58,6 +58,7 @@ class JSDOMEnvironment {
58
58
  global;
59
59
  errorEventListener;
60
60
  moduleMocker;
61
+ customExportConditions = ['browser'];
61
62
 
62
63
  constructor(config, context) {
63
64
  const {projectConfig} = config;
@@ -129,6 +130,21 @@ class JSDOMEnvironment {
129
130
  return originalRemoveListener.apply(this, args);
130
131
  };
131
132
 
133
+ if ('customExportConditions' in projectConfig.testEnvironmentOptions) {
134
+ const {customExportConditions} = projectConfig.testEnvironmentOptions;
135
+
136
+ if (
137
+ Array.isArray(customExportConditions) &&
138
+ customExportConditions.every(item => typeof item === 'string')
139
+ ) {
140
+ this.customExportConditions = customExportConditions;
141
+ } else {
142
+ throw new Error(
143
+ 'Custom export conditions specified but they are not an array of strings'
144
+ );
145
+ }
146
+ }
147
+
132
148
  this.moduleMocker = new (_jestMock().ModuleMocker)(global);
133
149
  this.fakeTimers = new (_fakeTimers().LegacyFakeTimers)({
134
150
  config: projectConfig,
@@ -180,7 +196,7 @@ class JSDOMEnvironment {
180
196
  }
181
197
 
182
198
  exportConditions() {
183
- return ['browser'];
199
+ return this.customExportConditions;
184
200
  }
185
201
 
186
202
  getVmContext() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-environment-jsdom",
3
- "version": "28.0.0",
3
+ "version": "28.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/facebook/jest.git",
@@ -17,23 +17,23 @@
17
17
  "./package.json": "./package.json"
18
18
  },
19
19
  "dependencies": {
20
- "@jest/environment": "^28.0.0",
21
- "@jest/fake-timers": "^28.0.0",
22
- "@jest/types": "^28.0.0",
20
+ "@jest/environment": "^28.1.0",
21
+ "@jest/fake-timers": "^28.1.0",
22
+ "@jest/types": "^28.1.0",
23
23
  "@types/jsdom": "^16.2.4",
24
24
  "@types/node": "*",
25
- "jest-mock": "^28.0.0",
26
- "jest-util": "^28.0.0",
25
+ "jest-mock": "^28.1.0",
26
+ "jest-util": "^28.1.0",
27
27
  "jsdom": "^19.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@jest/test-utils": "^28.0.0"
30
+ "@jest/test-utils": "^28.1.0"
31
31
  },
32
32
  "engines": {
33
- "node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
33
+ "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "8f9b812faf8e4d241d560a8574f0c6ed20a89365"
38
+ "gitHead": "f5db241312f46528389e55c38221e6b6968622cf"
39
39
  }