froth-webdriverio-framework 4.0.21 → 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.
@@ -1,5 +1,4 @@
1
1
  const path = require('path');
2
- const { ESLint } = require("eslint");
3
2
  const { LocalStorage } = require('node-localstorage');
4
3
  global.BUFFER = new LocalStorage('./storage');
5
4
  global.suite_info = null;
@@ -43,25 +42,26 @@ const commonconfig = {
43
42
  try {
44
43
  const eslint = new ESLint();
45
44
  let syntaxFailed = false;
46
-
45
+
47
46
  console.log('==== BEFORE SESSION HOOK ====');
48
47
  // Perform any setup or pre-test actions here
49
48
  console.log("specdat:", specs);
50
49
  console.log("length:", specs.length);
51
50
  for (const fileUrl of specs) {
52
- const filePath = new URL(fileUrl).pathname;
53
- const results = await eslint.lintFiles([filePath]);
54
-
55
- results.forEach(result => {
56
- result.messages.forEach(msg => {
57
- if (msg.fatal || msg.severity === 2) {
58
- const message = `❌ ESLint error in ${result.filePath} [line ${msg.line}]: ${msg.message}`;
59
- console.error(message);
60
- resultdetails.comments.push(message);
61
- syntaxFailed = true;
62
- }
63
- });
64
- });
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
65
  }
66
66
  if (syntaxFailed) {
67
67
  resultdetails.excution_status = 'FAILED';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.21",
3
+ "version": "4.0.22",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -47,7 +47,6 @@
47
47
  "node-localstorage": "^3.0.5",
48
48
  "randexp": "^0.5.3",
49
49
  "ts-node": "^10.9.2",
50
- "typescript": "^5.4.5",
51
- "eslint": "^9.24.0"
50
+ "typescript": "^5.4.5"
52
51
  }
53
52
  }
package/eslint.config.mjs DELETED
@@ -1,9 +0,0 @@
1
- import { defineConfig } from "eslint/config";
2
- import js from "@eslint/js";
3
- import globals from "globals";
4
-
5
-
6
- export default defineConfig([
7
- { files: ["**/*.{js,mjs,cjs}"], plugins: { js }, extends: ["js/recommended"] },
8
- { files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.browser } },
9
- ]);