artes 1.5.8 → 1.5.10

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.
@@ -14,7 +14,11 @@ try {
14
14
  console.log("Proceeding with default config.");
15
15
  }
16
16
 
17
- const defaultFormats = ["rerun:@rerun.txt", "progress-bar", './src/helper/controller/status-formatter.js:null'];
17
+ const defaultFormats = [
18
+ "rerun:@rerun.txt",
19
+ "progress-bar",
20
+ "./src/helper/controller/status-formatter.js:null",
21
+ ];
18
22
 
19
23
  const userFormatsFromEnv = process.env.REPORT_FORMAT
20
24
  ? JSON.parse(process.env.REPORT_FORMAT)
@@ -52,7 +56,6 @@ function resolveEnv(artesConfig) {
52
56
  const env = resolveEnv(artesConfig);
53
57
 
54
58
  function loadVariables(cliVariables, artesConfigVariables) {
55
-
56
59
  if (cliVariables) {
57
60
  try {
58
61
  cliVariables = JSON.parse(cliVariables);
@@ -72,13 +75,12 @@ function loadVariables(cliVariables, artesConfigVariables) {
72
75
 
73
76
  const resolveFeaturePaths = (basePath, value) => {
74
77
  return value
75
- .split(',')
76
- .map(p => p.trim())
78
+ .split(",")
79
+ .map((p) => p.trim())
77
80
  .filter(Boolean)
78
- .map(p => path.join(basePath, p));
81
+ .map((p) => path.join(basePath, p));
79
82
  };
80
83
 
81
-
82
84
  module.exports = {
83
85
  default: {
84
86
  // File paths and patterns
@@ -88,13 +90,13 @@ module.exports = {
88
90
  timeout: process.env.TIMEOUT
89
91
  ? Number(process.env.TIMEOUT) * 1000
90
92
  : artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
91
- paths: process.env.RERUN
93
+ paths: process.env.RERUN
92
94
  ? [path.join("../../", process.env.RERUN)]
93
95
  : process.env.FEATURES
94
96
  ? resolveFeaturePaths(moduleConfig.projectPath, process.env.FEATURES)
95
97
  : artesConfig.features
96
98
  ? resolveFeaturePaths(moduleConfig.projectPath, artesConfig.features)
97
- : [moduleConfig.featuresPath], // Paths to feature files
99
+ : [moduleConfig.featuresPath], // Paths to feature files
98
100
  require: [
99
101
  process.env.STEP_DEFINITIONS
100
102
  ? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
@@ -173,14 +175,14 @@ module.exports = {
173
175
  },
174
176
  report: {
175
177
  logo: process.env.LOGO
176
- ? process.env.LOGO
177
- : artesConfig?.logo || "./logo.png",
178
- brandName: process.env.BRAND_NAME
178
+ ? process.env.LOGO
179
+ : artesConfig?.logo || "./logo.png",
180
+ brandName: process.env.BRAND_NAME
179
181
  ? process.env.BRAND_NAME
180
182
  : artesConfig?.brandName || "ARTES",
181
- reportName: process.env.REPORT_NAME
182
- ? process.env.REPORT_NAME
183
- : artesConfig?.reportName || "ARTES REPORT",
183
+ reportName: process.env.REPORT_NAME
184
+ ? process.env.REPORT_NAME
185
+ : artesConfig?.reportName || "ARTES REPORT",
184
186
  singleFileReport:
185
187
  process.env.SINGLE_FILE_REPORT == "true"
186
188
  ? true
package/executer.js CHANGED
@@ -10,10 +10,14 @@ const {
10
10
  const { logPomWarnings } = require("./src/helper/controller/pomCollector");
11
11
  const fs = require("fs");
12
12
  const path = require("path");
13
- const { testCoverageCalculator } = require("./src/helper/controller/testCoverageCalculator");
13
+ const {
14
+ testCoverageCalculator,
15
+ } = require("./src/helper/controller/testCoverageCalculator");
14
16
  const { getExecutor } = require("./src/helper/controller/getExecutor");
15
- const { findDuplicateTestNames } = require("./src/helper/controller/findDuplicateTestNames");
16
-
17
+ const {
18
+ findDuplicateTestNames,
19
+ } = require("./src/helper/controller/findDuplicateTestNames");
20
+ const { getEnvInfo } = require("artes/src/helper/controller/getEnvInfo");
17
21
 
18
22
  const artesConfigPath = path.resolve(process.cwd(), "artes.config.js");
19
23
 
@@ -42,8 +46,8 @@ const flags = {
42
46
  reportWithTrace: args.includes("-rwt") || args.includes("--reportWithTrace"),
43
47
  singleFileReport: args.includes("--singleFileReport"),
44
48
  customLogo: args.includes("--logo"),
45
- customBrandName:args.includes("--brandName"),
46
- customReportName:args.includes("--reportName"),
49
+ customBrandName: args.includes("--brandName"),
50
+ customReportName: args.includes("--reportName"),
47
51
  zip: args.includes("--zip"),
48
52
  features: args.includes("--features"),
49
53
  stepDef: args.includes("--stepDef"),
@@ -67,7 +71,6 @@ const flags = {
67
71
  slowMo: args.includes("--slowMo"),
68
72
  };
69
73
 
70
-
71
74
  const env = getArgValue("--env");
72
75
  const vars = getArgValue("--saveVar");
73
76
  const logo = getArgValue("--logo");
@@ -89,7 +92,6 @@ const height = getArgValue("--height");
89
92
  const timeout = getArgValue("--timeout");
90
93
  const slowMo = getArgValue("--slowMo");
91
94
 
92
-
93
95
  flags.env ? (process.env.ENV = env) : "";
94
96
 
95
97
  vars ? (process.env.VARS = vars) : "";
@@ -171,8 +173,6 @@ flags.timeout ? (process.env.TIMEOUT = timeout) : "";
171
173
 
172
174
  flags.slowMo ? (process.env.SLOWMO = slowMo) : "";
173
175
 
174
-
175
-
176
176
  function main() {
177
177
  if (flags.help) return showHelp();
178
178
  if (flags.version) return showVersion();
@@ -184,63 +184,62 @@ function main() {
184
184
 
185
185
  findDuplicateTestNames();
186
186
 
187
- const testCoverage = testCoverageCalculator()
187
+ const testCoverage = testCoverageCalculator();
188
188
 
189
- const testPercentage = (process.env.PERCENTAGE ? Number(process.env.PERCENTAGE) : artesConfig.testPercentage || 0)
189
+ const testPercentage = process.env.PERCENTAGE
190
+ ? Number(process.env.PERCENTAGE)
191
+ : artesConfig.testPercentage || 0;
190
192
 
191
193
  if (testPercentage > 0) {
192
-
193
- const meetsThreshold = testCoverage.percentage >= testPercentage
194
+ const meetsThreshold = testCoverage.percentage >= testPercentage;
194
195
 
195
196
  if (meetsThreshold) {
196
197
  console.log(
197
- `✅ Tests passed required ${testPercentage}% success rate with ${testCoverage.percentage.toFixed(2)}%!`,
198
+ `\x1b[32mTests passed required ${testPercentage}% success rate with ${testCoverage.percentage.toFixed(2)}%!\x1b[0m`,
198
199
  );
199
200
  process.env.EXIT_CODE = parseInt(0, 10);
200
201
  } else {
201
202
  console.log(
202
- `❌ Tests failed required ${testPercentage}% success rate with ${testCoverage.percentage.toFixed(2)}%!`,
203
+ `\x1b[31mTests failed required ${testPercentage}% success rate with ${testCoverage.percentage.toFixed(2)}%!\x1b[0m`,
203
204
  );
204
205
  process.env.EXIT_CODE = parseInt(1, 10);
205
206
  }
206
207
  }
207
208
 
209
+ const source = path.join(
210
+ process.cwd(),
211
+ "node_modules",
212
+ "artes",
213
+ "@rerun.txt",
214
+ );
215
+ const destination = path.join(process.cwd(), "@rerun.txt");
208
216
 
209
- const source = path.join(process.cwd(), "node_modules", "artes", "@rerun.txt");
210
- const destination = path.join(process.cwd(), "@rerun.txt");
211
-
212
- if (fs.existsSync(source)) {
213
- fs.renameSync(source, destination);
214
- }
217
+ if (fs.existsSync(source)) {
218
+ fs.renameSync(source, destination);
219
+ }
215
220
 
216
221
  if (
217
222
  flags.reportWithTrace ||
218
223
  artesConfig.reportWithTrace ||
219
224
  flags.report ||
220
225
  artesConfig.report
221
- ){
222
- const executor = getExecutor();
223
-
224
- if(fs.existsSync(path.join(process.cwd(), "node_modules", "artes",'allure-result'))){
225
- fs.writeFileSync(
226
- path.join(process.cwd(), "node_modules", "artes",'allure-result',"executor.json"),
227
- JSON.stringify(executor, null, 2)
228
- );
229
- }
230
-
231
- generateReport();
232
-
226
+ ) {
227
+ getExecutor();
228
+ getEnvInfo();
229
+ generateReport();
233
230
  }
234
231
 
235
- if (!( process.env.TRACE === "true"
232
+ if (
233
+ !(process.env.TRACE === "true"
236
234
  ? process.env.TRACE
237
- : artesConfig.trace || false)) {
238
- fs.rmSync(path.join(process.cwd(), "traces"), {
239
- recursive: true,
240
- force: true,
241
- });
242
- }
243
-
235
+ : artesConfig.trace || false)
236
+ ) {
237
+ fs.rmSync(path.join(process.cwd(), "traces"), {
238
+ recursive: true,
239
+ force: true,
240
+ });
241
+ }
242
+
244
243
  cleanUp();
245
244
  process.exit(process.env.EXIT_CODE);
246
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,9 +38,8 @@ function selectorSeparator(element) {
38
38
  }
39
39
  }
40
40
 
41
- function getSelector(element) {
42
-
43
- element = resolveVariable(element)
41
+ function getSelector(element) {
42
+ element = resolveVariable(element);
44
43
 
45
44
  const selector =
46
45
  elements?.[element]?.selector || elements?.[element] || element;
@@ -94,9 +93,7 @@ function getElement(element) {
94
93
  return locator;
95
94
  }
96
95
 
97
-
98
96
  function extractVarsFromResponse(responseBody, vars, customVarNames) {
99
-
100
97
  function getValueByPath(obj, path) {
101
98
  const keys = path.split(".");
102
99
  let current = obj;
@@ -124,13 +121,13 @@ function extractVarsFromResponse(responseBody, vars, customVarNames) {
124
121
  .join("");
125
122
  }
126
123
 
127
- const varPaths = vars.split(",").map(v => v.trim());
124
+ const varPaths = vars.split(",").map((v) => v.trim());
128
125
  let customNames = [];
129
126
 
130
127
  if (!customVarNames) {
131
128
  customNames = varPaths.map(pathToCamelCase);
132
129
  } else if (typeof customVarNames === "string") {
133
- customNames = customVarNames.split(",").map(n => n.trim());
130
+ customNames = customVarNames.split(",").map((n) => n.trim());
134
131
  } else if (Array.isArray(customVarNames)) {
135
132
  customNames = customVarNames;
136
133
  } else {
@@ -2,53 +2,67 @@ const fs = require("fs");
2
2
  const path = require("path");
3
3
 
4
4
  function findDuplicateTestNames() {
5
- const testStatusFile = path.join(process.cwd(), "node_modules", "artes" , "test-status", 'test-status.txt');
6
-
7
- if (!fs.existsSync(testStatusFile)) {
8
- console.error('test-status.txt not found');
9
- return;
5
+ const testStatusFile = path.join(
6
+ process.cwd(),
7
+ "node_modules",
8
+ "artes",
9
+ "test-status",
10
+ "test-status.txt",
11
+ );
12
+
13
+ if (!fs.existsSync(testStatusFile)) {
14
+ console.error("test-status.txt not found");
15
+ return;
16
+ }
17
+
18
+ const content = fs.readFileSync(testStatusFile, "utf8");
19
+ const lines = content.split("\n").filter((line) => line.trim());
20
+
21
+ const testNameToEntries = {};
22
+
23
+ lines.forEach((line) => {
24
+ const parts = line.split(" | ");
25
+ if (parts.length < 5) return;
26
+
27
+ const testName = parts[2].trim();
28
+ const filePath = parts[4].trim();
29
+ const uuid = parts[3].trim();
30
+
31
+ if (!testNameToEntries[testName]) {
32
+ testNameToEntries[testName] = [];
10
33
  }
11
-
12
- const content = fs.readFileSync(testStatusFile, 'utf8');
13
- const lines = content.split('\n').filter(line => line.trim());
14
-
15
- const testNameToFiles = {};
16
-
17
- lines.forEach(line => {
18
- const parts = line.split(' | ');
19
- if (parts.length < 5) return;
20
-
21
- const testName = parts[2].trim();
22
- const filePath = parts[4].trim();
23
-
24
- if (!testNameToFiles[testName]) {
25
- testNameToFiles[testName] = new Set();
26
- }
27
-
28
- testNameToFiles[testName].add(filePath);
29
- });
30
-
31
- const duplicates = {};
32
-
33
- Object.entries(testNameToFiles).forEach(([testName, files]) => {
34
- if (files.size > 1) {
35
- duplicates[testName] = Array.from(files);
36
- }
37
- });
38
-
39
- if (Object.keys(duplicates).length > 0) {
40
- console.warn('\n\x1b[33m[WARNING] Duplicate scenarios names found: This will effect your reporting');
41
- Object.entries(duplicates).forEach(([testName, files]) => {
42
- console.log(`\x1b[33m"${testName}" exists in:`);
43
- files.forEach(file => {
44
- console.log(` - ${file}`);
45
- });
46
- console.log('');
34
+
35
+ const alreadyExists = testNameToEntries[testName].some(
36
+ (e) => e.uuid === uuid,
37
+ );
38
+ if (!alreadyExists) {
39
+ testNameToEntries[testName].push({ filePath, uuid });
40
+ }
41
+ });
42
+
43
+ const duplicates = {};
44
+
45
+ Object.entries(testNameToEntries).forEach(([testName, entries]) => {
46
+ if (entries.length > 1) {
47
+ duplicates[testName] = entries.map((e) => e.filePath);
48
+ }
49
+ });
50
+
51
+ if (Object.keys(duplicates).length > 0) {
52
+ console.warn(
53
+ "\n\x1b[33m[WARNING] Duplicate scenario names found: This will affect your reporting",
54
+ );
55
+ Object.entries(duplicates).forEach(([testName, files]) => {
56
+ console.log(`\x1b[33m"${testName}" exists in:`);
57
+ files.forEach((file) => {
58
+ console.log(` - ${file}`);
47
59
  });
48
- console.log("\x1b[0m");
49
- }
50
-
51
- return duplicates;
60
+ console.log("");
61
+ });
62
+ console.log("\x1b[0m");
52
63
  }
53
64
 
54
- module.exports = {findDuplicateTestNames}
65
+ return duplicates;
66
+ }
67
+
68
+ module.exports = { findDuplicateTestNames };
@@ -0,0 +1,86 @@
1
+ const os = require("os");
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+ const { moduleConfig } = require("artes/src/helper/imports/commons");
5
+
6
+ async function getEnvInfo() {
7
+ delete require.cache[require.resolve("../../../cucumber.config.js")];
8
+ const cucumberConfig = require("../../../cucumber.config.js");
9
+
10
+ let baseURL = "";
11
+
12
+ if (typeof cucumberConfig.baseURL === "object") {
13
+ const env = (cucumberConfig.env || "").trim();
14
+ baseURL = cucumberConfig.baseURL[env];
15
+ } else {
16
+ baseURL = cucumberConfig.baseURL;
17
+ }
18
+
19
+ if (fs.existsSync(path.join(moduleConfig.modulePath, "browser-info.json"))) {
20
+ browserInfo = JSON.parse(
21
+ fs.readFileSync(
22
+ path.join(moduleConfig.modulePath, "browser-info.json"),
23
+ "utf8",
24
+ ),
25
+ );
26
+ }
27
+
28
+ const environment = {
29
+ // ── System ──────────────────────────────
30
+ OS_Name: os.type(),
31
+ OS_Version: os.release(),
32
+ OS_Platform: process.platform,
33
+ OS_Arch: os.arch(),
34
+ CPU_Cores: os.cpus().length,
35
+ CPU_Model: os.cpus()[0]?.model ?? "N/A",
36
+ RAM_Total: `${(os.totalmem() / 1024 / 1024 / 1024).toFixed(2)} GB`,
37
+ RAM_Free: `${(os.freemem() / 1024 / 1024 / 1024).toFixed(2)} GB`,
38
+ Hostname: os.hostname(),
39
+
40
+ // ── Node ────────────────────────────────
41
+ Node_Version: process.version,
42
+ NPM_Version: process.env.npm_config_user_agent ?? "N/A",
43
+ Working_Dir: process.cwd(),
44
+
45
+ // ── Browser ─────────────────────────────
46
+ Browser_Name: cucumberConfig.browser.browserType,
47
+ Browser_Version: browserInfo.BROWSER_VERSION,
48
+ Screen_Size: `w: ${browserInfo.BROWSER_WIDTH}px h:${browserInfo.BROWSER_HEIGHT}px`,
49
+ Headless: cucumberConfig.browser.headless ?? "N/A",
50
+
51
+ // ── Test Config ─────────────────────────
52
+ Base_URL: baseURL || "N/A",
53
+ Environment: cucumberConfig.env || "local",
54
+ Parallel_Runner: cucumberConfig.default.parallel,
55
+ Timeout: cucumberConfig.default.timeout ?? "N/A",
56
+
57
+ // ── Git ─────────────────────────────────
58
+ Git_Branch: process.env.GIT_BRANCH ?? process.env.BRANCH_NAME ?? "N/A",
59
+ Git_Commit: process.env.GIT_COMMIT ?? process.env.GIT_SHA ?? "N/A",
60
+ Git_Author: process.env.GIT_AUTHOR ?? "N/A",
61
+
62
+ // ── Timestamps ──────────────────────────
63
+ Run_Date: new Date().toLocaleDateString(),
64
+ Run_Time: new Date().toLocaleTimeString(),
65
+ Timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
66
+ };
67
+
68
+ const allureResultsDir = path.join(moduleConfig.modulePath, "allure-result");
69
+
70
+ if (!fs.existsSync(allureResultsDir)) {
71
+ fs.mkdirSync(allureResultsDir, { recursive: true });
72
+ }
73
+
74
+ const propertiesContent = Object.entries(environment)
75
+ .map(([key, value]) => `${key}=${value}`)
76
+ .join("\n");
77
+
78
+ fs.writeFileSync(
79
+ path.join(allureResultsDir, "environment.properties"),
80
+ propertiesContent,
81
+ );
82
+
83
+ return environment;
84
+ }
85
+
86
+ module.exports = { getEnvInfo };
@@ -1,104 +1,109 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
1
4
  function getExecutor() {
5
+ let executor;
6
+
7
+ if (process.env.GITHUB_RUN_ID) {
8
+ executor = {
9
+ name: "GitHub Actions",
10
+ type: "github",
11
+ buildName: `Workflow #${process.env.GITHUB_RUN_NUMBER}`,
12
+ buildOrder: Number(process.env.GITHUB_RUN_NUMBER),
13
+ buildUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
14
+ };
15
+ } else if (process.env.JENKINS_HOME) {
16
+ executor = {
17
+ name: "Jenkins",
18
+ type: "jenkins",
19
+ buildName: process.env.JOB_NAME || "Manual Run",
20
+ buildOrder: Number(process.env.BUILD_NUMBER) || 1,
21
+ buildUrl: process.env.BUILD_URL || "",
22
+ };
23
+ } else if (process.env.CI_PIPELINE_ID) {
24
+ executor = {
25
+ name: "GitLab CI",
26
+ type: "gitlab",
27
+ buildName: `Pipeline #${process.env.CI_PIPELINE_IID}`,
28
+ buildOrder: Number(process.env.CI_PIPELINE_IID) || 1,
29
+ buildUrl: process.env.CI_PIPELINE_URL || "",
30
+ };
31
+ } else if (process.env.BITBUCKET_BUILD_NUMBER) {
32
+ executor = {
33
+ name: "Bitbucket Pipelines",
34
+ type: "bitbucket",
35
+ buildName: `Build #${process.env.BITBUCKET_BUILD_NUMBER}`,
36
+ buildOrder: Number(process.env.BITBUCKET_BUILD_NUMBER),
37
+ buildUrl: process.env.BITBUCKET_BUILD_URL || "",
38
+ };
39
+ } else if (process.env.CIRCLE_WORKFLOW_ID) {
40
+ executor = {
41
+ name: "CircleCI",
42
+ type: "circleci",
43
+ buildName: `Workflow #${process.env.CIRCLE_WORKFLOW_ID}`,
44
+ buildOrder: Number(process.env.CIRCLE_BUILD_NUM) || 1,
45
+ buildUrl: process.env.CIRCLE_BUILD_URL || "",
46
+ };
47
+ } else if (process.env.BUILD_BUILDID) {
48
+ executor = {
49
+ name: "Azure Pipelines",
50
+ type: "azure",
51
+ buildName: `Build #${process.env.BUILD_BUILDID}`,
52
+ buildOrder: Number(process.env.BUILD_BUILDID) || 1,
53
+ buildUrl: process.env.BUILD_BUILDURI || "",
54
+ };
55
+ } else if (process.env.BUILD_NUMBER && process.env.TEAMCITY_VERSION) {
56
+ executor = {
57
+ name: "TeamCity",
58
+ type: "teamcity",
59
+ buildName: `Build #${process.env.BUILD_NUMBER}`,
60
+ buildOrder: Number(process.env.BUILD_NUMBER) || 1,
61
+ buildUrl: process.env.BUILD_URL || "",
62
+ };
63
+ } else if (process.env.TRAVIS_BUILD_NUMBER) {
64
+ executor = {
65
+ name: "Travis CI",
66
+ type: "travis",
67
+ buildName: `Build #${process.env.TRAVIS_BUILD_NUMBER}`,
68
+ buildOrder: Number(process.env.TRAVIS_BUILD_NUMBER) || 1,
69
+ buildUrl: process.env.TRAVIS_BUILD_WEB_URL || "",
70
+ };
71
+ } else if (process.env.bamboo_buildNumber) {
72
+ executor = {
73
+ name: "Bamboo",
74
+ type: "bamboo",
75
+ buildName: `Build #${process.env.bamboo_buildNumber}`,
76
+ buildOrder: Number(process.env.bamboo_buildNumber) || 1,
77
+ buildUrl: process.env.bamboo_resultsUrl || "",
78
+ };
79
+ } else {
80
+ executor = {
81
+ name: "Local Run",
82
+ type: "local",
83
+ buildName: "Manual Execution",
84
+ buildOrder: 1,
85
+ buildUrl: "",
86
+ };
87
+ }
2
88
 
3
- if (process.env.GITHUB_RUN_ID) {
4
- return {
5
- name: "GitHub Actions",
6
- type: "github",
7
- buildName: `Workflow #${process.env.GITHUB_RUN_NUMBER}`,
8
- buildOrder: Number(process.env.GITHUB_RUN_NUMBER),
9
- buildUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
10
- };
11
-
12
-
13
- } else if (process.env.JENKINS_HOME) {
14
- return {
15
- name: "Jenkins",
16
- type: "jenkins",
17
- buildName: process.env.JOB_NAME || "Manual Run",
18
- buildOrder: Number(process.env.BUILD_NUMBER) || 1,
19
- buildUrl: process.env.BUILD_URL || ""
20
- };
21
-
22
-
23
- } else if (process.env.CI_PIPELINE_ID) {
24
- return {
25
- name: "GitLab CI",
26
- type: "gitlab",
27
- buildName: `Pipeline #${process.env.CI_PIPELINE_IID}`,
28
- buildOrder: Number(process.env.CI_PIPELINE_IID) || 1,
29
- buildUrl: process.env.CI_PIPELINE_URL || ""
30
- };
31
-
32
-
33
- } else if (process.env.BITBUCKET_BUILD_NUMBER) {
34
- return {
35
- name: "Bitbucket Pipelines",
36
- type: "bitbucket",
37
- buildName: `Build #${process.env.BITBUCKET_BUILD_NUMBER}`,
38
- buildOrder: Number(process.env.BITBUCKET_BUILD_NUMBER),
39
- buildUrl: process.env.BITBUCKET_BUILD_URL || ""
40
- };
41
-
42
-
43
- } else if (process.env.CIRCLE_WORKFLOW_ID) {
44
- return {
45
- name: "CircleCI",
46
- type: "circleci",
47
- buildName: `Workflow #${process.env.CIRCLE_WORKFLOW_ID}`,
48
- buildOrder: Number(process.env.CIRCLE_BUILD_NUM) || 1,
49
- buildUrl: process.env.CIRCLE_BUILD_URL || ""
50
- };
51
-
52
-
53
- } else if (process.env.BUILD_BUILDID) {
54
- return {
55
- name: "Azure Pipelines",
56
- type: "azure",
57
- buildName: `Build #${process.env.BUILD_BUILDID}`,
58
- buildOrder: Number(process.env.BUILD_BUILDID) || 1,
59
- buildUrl: process.env.BUILD_BUILDURI || ""
60
- };
61
-
62
-
63
- } else if (process.env.BUILD_NUMBER && process.env.TEAMCITY_VERSION) {
64
- return {
65
- name: "TeamCity",
66
- type: "teamcity",
67
- buildName: `Build #${process.env.BUILD_NUMBER}`,
68
- buildOrder: Number(process.env.BUILD_NUMBER) || 1,
69
- buildUrl: process.env.BUILD_URL || ""
70
- };
71
-
72
-
73
- } else if (process.env.TRAVIS_BUILD_NUMBER) {
74
- return {
75
- name: "Travis CI",
76
- type: "travis",
77
- buildName: `Build #${process.env.TRAVIS_BUILD_NUMBER}`,
78
- buildOrder: Number(process.env.TRAVIS_BUILD_NUMBER) || 1,
79
- buildUrl: process.env.TRAVIS_BUILD_WEB_URL || ""
80
- };
81
-
82
-
83
- } else if (process.env.bamboo_buildNumber) {
84
- return {
85
- name: "Bamboo",
86
- type: "bamboo",
87
- buildName: `Build #${process.env.bamboo_buildNumber}`,
88
- buildOrder: Number(process.env.bamboo_buildNumber) || 1,
89
- buildUrl: process.env.bamboo_resultsUrl || ""
90
- };
91
-
92
-
93
- } else {
94
- return {
95
- name: "Local Run",
96
- type: "local",
97
- buildName: "Manual Execution",
98
- buildOrder: 1,
99
- buildUrl: ""
100
- };
101
- }
89
+ if (
90
+ fs.existsSync(
91
+ path.join(process.cwd(), "node_modules", "artes", "allure-result"),
92
+ )
93
+ ) {
94
+ fs.writeFileSync(
95
+ path.join(
96
+ process.cwd(),
97
+ "node_modules",
98
+ "artes",
99
+ "allure-result",
100
+ "executor.json",
101
+ ),
102
+ JSON.stringify(executor, null, 2),
103
+ );
102
104
  }
103
105
 
104
- module.exports = { getExecutor };
106
+ return executor;
107
+ }
108
+
109
+ module.exports = { getExecutor };