froth-webdriverio-framework 4.0.20 → 4.0.22

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.
@@ -40,10 +40,39 @@ const commonconfig = {
40
40
 
41
41
  beforeSession: async function (config, capabilities, specs) {
42
42
  try {
43
+ const eslint = new ESLint();
44
+ let syntaxFailed = false;
45
+
43
46
  console.log('==== BEFORE SESSION HOOK ====');
44
47
  // Perform any setup or pre-test actions here
45
48
  console.log("specdat:", specs);
46
49
  console.log("length:", specs.length);
50
+ for (const fileUrl of specs) {
51
+ const filePath = url.fileURLToPath(fileUrl); // convert file:// URL to file path
52
+ try {
53
+ const code = fs.readFileSync(filePath, 'utf8');
54
+ new Function(code); // Try to compile
55
+ } catch (err) {
56
+ // Extract line number from stack trace
57
+ const match = err.stack.match(/\((.*):(\d+):(\d+)\)/);
58
+ const lineInfo = match ? ` at line ${match[2]}, column ${match[3]}` : '';
59
+
60
+ const errorMsg = `❌ Syntax error in '${path.basename(filePath)}'${lineInfo}: ${err.message}`;
61
+ console.error("🚨", errorMsg);
62
+ resultdetails.comments.push(errorMsg);
63
+ syntaxFailed = true;
64
+ }
65
+ }
66
+ if (syntaxFailed) {
67
+ resultdetails.excution_status = 'FAILED';
68
+ await exeDetails.updateExecuitonDetails(
69
+ BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
70
+ BUFFER.getItem("FROTH_LOGIN_TOKEN"),
71
+ BUFFER.getItem("FROTH_EXECUTION_ID"),
72
+ resultdetails
73
+ );
74
+ process.exit(1);
75
+ }
47
76
 
48
77
  if (process.env.PLATFORM === 'browserstack') {
49
78
  /// console.log("capabilities:", capabilities);
@@ -175,7 +204,7 @@ const commonconfig = {
175
204
  scriptresult)
176
205
 
177
206
  if (localError)
178
- throw localError;
207
+ throw new Error(`Test failed: ${localError}`);
179
208
 
180
209
  },
181
210
  /**
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.20",
4
-
3
+ "version": "4.0.22",
5
4
  "readme": "WebdriverIO Integration",
6
5
  "description": "WebdriverIO and BrowserStack App Automate",
7
6
  "license": "MIT",