artes 1.1.19 → 1.1.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/executer.js CHANGED
@@ -8,6 +8,7 @@ const {
8
8
  cleanUp,
9
9
  } = require("./src/helper/executers/exporter");
10
10
  const fs = require("fs");
11
+ const path = require("path");
11
12
 
12
13
  const args = process.argv.slice(2);
13
14
 
@@ -113,9 +114,23 @@ function main() {
113
114
  runTests();
114
115
  if (flags.report) generateReport();
115
116
 
116
- if (fs.existsSync("./node_modules/artes/testsStatus/EXIT_CODE.txt")) {
117
+ if (
118
+ fs.existsSync(
119
+ path.join(
120
+ process.cwd(),
121
+ "node_modules",
122
+ "artes",
123
+ "EXIT_CODE.txt",
124
+ ),
125
+ )
126
+ ) {
117
127
  const data = fs.readFileSync(
118
- "./node_modules/artes/testsStatus/EXIT_CODE.txt",
128
+ path.join(
129
+ process.cwd(),
130
+ "node_modules",
131
+ "artes",
132
+ "EXIT_CODE.txt",
133
+ ),
119
134
  "utf8",
120
135
  );
121
136
  process.env.EXIT_CODE = parseInt(data, 10);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,12 +3,27 @@ const path = require("path");
3
3
  const fs = require("fs");
4
4
 
5
5
  function showVersion() {
6
- const artesVersion = execSync("npm root -g").toString().trim();
7
- const artesGPackageJSONPath = path.join(artesVersion, "artes/package.json");
8
- const asrtesGPackageJSON = JSON.parse(
9
- fs.readFileSync(artesGPackageJSONPath, "utf8"),
10
- );
11
- console.log(`ARTES Version: ${asrtesGPackageJSON.version}`);
6
+ try {
7
+ const localPath = path.join(
8
+ process.cwd(),
9
+ "node_modules",
10
+ "artes",
11
+ "package.json",
12
+ );
13
+ const localData = fs.readFileSync(localPath, "utf8");
14
+ const localArtes = JSON.parse(localData);
15
+ console.log(`ARTES Version: ${localArtes.version}`);
16
+ return;
17
+ } catch (err) {}
18
+
19
+ try {
20
+ const globalRoot = execSync("npm root -g").toString().trim();
21
+ const globalPath = path.join(globalRoot, "artes", "package.json");
22
+ const globalData = fs.readFileSync(globalPath, "utf8");
23
+ const globalArtes = JSON.parse(globalData);
24
+ console.log(`ARTES Version: ${globalArtes.version}`);
25
+ return;
26
+ } catch (err) {}
12
27
  }
13
28
 
14
29
  module.exports = {
@@ -35,7 +35,7 @@ const moduleConfig = {
35
35
  stepsPath: path.join(projectPath, "/tests/steps/*.js"),
36
36
  pomPath: path.join(projectPath, "/tests/POMs"),
37
37
  cleanUpPaths:
38
- "allure-result allure-results test-results @rerun.txt testsStatus",
38
+ "allure-result allure-results test-results @rerun.txt testsStatus EXIT_CODE.txt"
39
39
  };
40
40
 
41
41
  module.exports = {
@@ -155,12 +155,12 @@ AfterAll(async function () {
155
155
  console.log(
156
156
  `Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}% !`,
157
157
  );
158
- fs.writeFileSync(path.join(statusDir, `EXIT_CODE.txt`), "0");
158
+ fs.writeFileSync(path.join(process.cwd(), `EXIT_CODE.txt`), "0");
159
159
  } else {
160
160
  console.log(
161
161
  `Tests failed at required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
162
162
  );
163
- fs.writeFileSync(path.join(statusDir, `EXIT_CODE.txt`), "1");
163
+ fs.writeFileSync(path.join(process.cwd(), `EXIT_CODE.txt`), "1");
164
164
  }
165
165
  }
166
166
  }