froth-webdriverio-framework 5.0.12 → 5.0.13

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.
@@ -11,7 +11,6 @@ const { error } = require('console');
11
11
  const HTMLReportGenerator = require('wdio-json-html-reporter').HTMLReportGenerator;
12
12
  global.Util = require('./globalUtilShim');
13
13
 
14
- let Util;
15
14
 
16
15
  //const isBrowserStackEnabled = process.env.BROWSERSTACK;
17
16
  let starttime;
@@ -165,12 +164,21 @@ const commonconfig = {
165
164
  console.log('==== BEFORE HOOK FOR MOBILE ====');
166
165
  }
167
166
 
168
- console.log("🔧 Initializing environment setup...");
167
+ const Module = require('module');
168
+ const originalRequire = Module.prototype.require;
169
169
 
170
- global.require = (p) => {
171
- if (p.includes('froth_common_actions/Utils')) return global.Util;
172
- return module.constructor.prototype.require.call(this, p);
170
+ Module.prototype.require = function (path) {
171
+ // Intercept only for the Utils file
172
+ if (path.includes('froth_common_actions/Utils')) {
173
+ console.log('⚡ Overriding require for:', path);
174
+ return require('./globalUtilShim'); // <-- path relative to wdio.conf.js
175
+ }
176
+
177
+ return originalRequire.apply(this, arguments);
173
178
  };
179
+
180
+ // Optionally also expose globally
181
+ global.Util = require('./globalUtilShim');
174
182
  },
175
183
 
176
184
  /**
@@ -28,7 +28,9 @@ if (!loaded) {
28
28
  console.error('❌ Could not load froth_common_actions/Utils from known paths or npm package');
29
29
  throw err;
30
30
  }
31
- }
32
- console.log("global Util loaded from:", global.Util && global.Util.constructor.name);
31
+ }else
32
+ console.log('✅ Global Util already defined');
33
+
34
+ console.log("global Util loaded from:", global.Util);
33
35
 
34
36
  module.exports = global.Util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "5.0.12",
3
+ "version": "5.0.13",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",