@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/jest-environment-ui5",
3
- "version": "5.3.13",
3
+ "version": "5.3.14",
4
4
  "description": "Jest matchers for files and folders",
5
5
  "repository": {
6
6
  "type": "git",
@@ -129,7 +129,7 @@ function createMockXHR(globalWindow, pathMappingFn, shimmedFilePath, mockData, X
129
129
  responseText: this.responseText
130
130
  });
131
131
  } else {
132
- this['onload'].apply(this, []);
132
+ this.onload();
133
133
  }
134
134
  },
135
135
  /**
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 setup the UI5 environment.
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
- function (Lib) {
148
+ (Lib) => {
150
149
  const fnInit = Lib.init;
151
150
  const fnLoad = Lib._load;
152
- Lib._load = function (mSettings) {
153
- if (that.testEnvironmentOptions.shimManifests) {
151
+ Lib._load = (mSettings) => {
152
+ if (this.testEnvironmentOptions.shimManifests) {
154
153
  const name = typeof mSettings === 'string' ? mSettings : mSettings.name;
155
- that.shimManifestFile(name);
154
+ this.shimManifestFile(name);
156
155
  }
157
156
 
158
157
  return fnLoad.call(this, mSettings);
159
158
  };
160
- Lib.init = function (mSettings) {
161
- if (that.testEnvironmentOptions.shimManifests) {
162
- that.shimManifestFile(mSettings.name);
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 (e) {
169
+ function () {
171
170
  resolve();
172
171
  }
173
172
  );