jest-environment-jsdom 28.0.1 → 28.1.1
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 +1 -0
- package/build/index.js +19 -3
- package/package.json +9 -9
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,
|
|
@@ -143,7 +159,7 @@ class JSDOMEnvironment {
|
|
|
143
159
|
config: projectConfig,
|
|
144
160
|
global: global
|
|
145
161
|
});
|
|
146
|
-
}
|
|
162
|
+
} // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
147
163
|
|
|
148
164
|
async setup() {}
|
|
149
165
|
|
|
@@ -171,7 +187,7 @@ class JSDOMEnvironment {
|
|
|
171
187
|
});
|
|
172
188
|
}
|
|
173
189
|
|
|
174
|
-
this.errorEventListener = null; // @ts-expect-error
|
|
190
|
+
this.errorEventListener = null; // @ts-expect-error: this.global not allowed to be `null`
|
|
175
191
|
|
|
176
192
|
this.global = null;
|
|
177
193
|
this.dom = null;
|
|
@@ -180,7 +196,7 @@ class JSDOMEnvironment {
|
|
|
180
196
|
}
|
|
181
197
|
|
|
182
198
|
exportConditions() {
|
|
183
|
-
return
|
|
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.
|
|
3
|
+
"version": "28.1.1",
|
|
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.
|
|
21
|
-
"@jest/fake-timers": "^28.
|
|
22
|
-
"@jest/types": "^28.
|
|
20
|
+
"@jest/environment": "^28.1.1",
|
|
21
|
+
"@jest/fake-timers": "^28.1.1",
|
|
22
|
+
"@jest/types": "^28.1.1",
|
|
23
23
|
"@types/jsdom": "^16.2.4",
|
|
24
24
|
"@types/node": "*",
|
|
25
|
-
"jest-mock": "^28.
|
|
26
|
-
"jest-util": "^28.
|
|
25
|
+
"jest-mock": "^28.1.1",
|
|
26
|
+
"jest-util": "^28.1.1",
|
|
27
27
|
"jsdom": "^19.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@jest/test-utils": "^28.
|
|
30
|
+
"@jest/test-utils": "^28.1.1"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": "^12.13.0 || ^14.15.0 || ^16.
|
|
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": "
|
|
38
|
+
"gitHead": "eb954f8874960920ac50a8f976bb333fbb06ada9"
|
|
39
39
|
}
|