artes 1.1.18 → 1.1.20

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
@@ -7,6 +7,8 @@ const {
7
7
  generateReport,
8
8
  cleanUp,
9
9
  } = require("./src/helper/executers/exporter");
10
+ const fs = require("fs");
11
+ const path = require("path");
10
12
 
11
13
  const args = process.argv.slice(2);
12
14
 
@@ -111,6 +113,31 @@ function main() {
111
113
 
112
114
  runTests();
113
115
  if (flags.report) generateReport();
116
+
117
+ if (
118
+ fs.existsSync(
119
+ path.join(
120
+ process.cwd(),
121
+ "node_modules",
122
+ "artes",
123
+ "testsStatus",
124
+ "EXIT_CODE.txt",
125
+ ),
126
+ )
127
+ ) {
128
+ const data = fs.readFileSync(
129
+ path.join(
130
+ process.cwd(),
131
+ "node_modules",
132
+ "artes",
133
+ "testsStatus",
134
+ "EXIT_CODE.txt",
135
+ ),
136
+ "utf8",
137
+ );
138
+ process.env.EXIT_CODE = parseInt(data, 10);
139
+ }
140
+
114
141
  cleanUp();
115
142
  process.exit(process.env.EXIT_CODE);
116
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
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 = {
@@ -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
- process.env.EXIT_CODE = 0;
158
+ fs.writeFileSync(path.join(statusDir, `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
- process.env.EXIT_CODE = 1;
163
+ fs.writeFileSync(path.join(statusDir, `EXIT_CODE.txt`), "1");
164
164
  }
165
165
  }
166
166
  }