@sap-ux/jest-environment-ui5 5.3.13 → 5.3.14
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/package.json +1 -1
- package/src/env/mockXHR.js +1 -1
- package/src/index.js +10 -11
package/package.json
CHANGED
package/src/env/mockXHR.js
CHANGED
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@ const JSDOMEnvironment = require('jest-environment-jsdom').default;
|
|
|
2
2
|
const { initTsConfigMappingStrategy } = require('./utils/tsMappingStrategy');
|
|
3
3
|
const { initUi5MappingStrategy } = require('./utils/ui5MappingStrategy');
|
|
4
4
|
const { initUI5Environment } = require('./env/ui5Environment');
|
|
5
|
-
const path = require('path');
|
|
5
|
+
const path = require('node:path');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Define the custom environment for the jest tests that runs in a UI5 environment
|
|
@@ -33,7 +33,7 @@ class UI5DOMEnvironment extends JSDOMEnvironment {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Prepare the environment for the test.
|
|
36
|
-
* This is called before each test and will
|
|
36
|
+
* This is called before each test and will set up the UI5 environment.
|
|
37
37
|
* @returns {Promise<void>} A promise that resolves when the environment is ready
|
|
38
38
|
*/
|
|
39
39
|
async setup() {
|
|
@@ -143,23 +143,22 @@ class UI5DOMEnvironment extends JSDOMEnvironment {
|
|
|
143
143
|
* @param {boolean} allowCSS Whether to allow the UI5 CSS to be loaded
|
|
144
144
|
*/
|
|
145
145
|
overwriteUi5Lib(resolve, allowCSS) {
|
|
146
|
-
const that = this;
|
|
147
146
|
sap.ui.require(
|
|
148
147
|
['sap/ui/core/Lib'],
|
|
149
|
-
|
|
148
|
+
(Lib) => {
|
|
150
149
|
const fnInit = Lib.init;
|
|
151
150
|
const fnLoad = Lib._load;
|
|
152
|
-
Lib._load =
|
|
153
|
-
if (
|
|
151
|
+
Lib._load = (mSettings) => {
|
|
152
|
+
if (this.testEnvironmentOptions.shimManifests) {
|
|
154
153
|
const name = typeof mSettings === 'string' ? mSettings : mSettings.name;
|
|
155
|
-
|
|
154
|
+
this.shimManifestFile(name);
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
return fnLoad.call(this, mSettings);
|
|
159
158
|
};
|
|
160
|
-
Lib.init =
|
|
161
|
-
if (
|
|
162
|
-
|
|
159
|
+
Lib.init = (mSettings) => {
|
|
160
|
+
if (this.testEnvironmentOptions.shimManifests) {
|
|
161
|
+
this.shimManifestFile(mSettings.name);
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
mSettings.noLibraryCSS = !allowCSS;
|
|
@@ -167,7 +166,7 @@ class UI5DOMEnvironment extends JSDOMEnvironment {
|
|
|
167
166
|
};
|
|
168
167
|
resolve();
|
|
169
168
|
},
|
|
170
|
-
function (
|
|
169
|
+
function () {
|
|
171
170
|
resolve();
|
|
172
171
|
}
|
|
173
172
|
);
|