froth-webdriverio-framework 4.0.20 → 4.0.21
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/eslint.config.mjs +9 -0
- package/froth_configs/commonconfig.js +30 -1
- package/package.json +3 -3
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const { ESLint } = require("eslint");
|
|
2
3
|
const { LocalStorage } = require('node-localstorage');
|
|
3
4
|
global.BUFFER = new LocalStorage('./storage');
|
|
4
5
|
global.suite_info = null;
|
|
@@ -40,10 +41,38 @@ const commonconfig = {
|
|
|
40
41
|
|
|
41
42
|
beforeSession: async function (config, capabilities, specs) {
|
|
42
43
|
try {
|
|
44
|
+
const eslint = new ESLint();
|
|
45
|
+
let syntaxFailed = false;
|
|
46
|
+
|
|
43
47
|
console.log('==== BEFORE SESSION HOOK ====');
|
|
44
48
|
// Perform any setup or pre-test actions here
|
|
45
49
|
console.log("specdat:", specs);
|
|
46
50
|
console.log("length:", specs.length);
|
|
51
|
+
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
|
+
});
|
|
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.
|
|
4
|
-
|
|
3
|
+
"version": "4.0.21",
|
|
5
4
|
"readme": "WebdriverIO Integration",
|
|
6
5
|
"description": "WebdriverIO and BrowserStack App Automate",
|
|
7
6
|
"license": "MIT",
|
|
@@ -48,6 +47,7 @@
|
|
|
48
47
|
"node-localstorage": "^3.0.5",
|
|
49
48
|
"randexp": "^0.5.3",
|
|
50
49
|
"ts-node": "^10.9.2",
|
|
51
|
-
"typescript": "^5.4.5"
|
|
50
|
+
"typescript": "^5.4.5",
|
|
51
|
+
"eslint": "^9.24.0"
|
|
52
52
|
}
|
|
53
53
|
}
|