artes 1.2.0 → 1.2.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/hooks/hooks.js +11 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -64,12 +64,13 @@ if (fs.existsSync(projectHooksPath)) {
64
64
  /* ------------------- Hooks ------------------- */
65
65
 
66
66
  BeforeAll(() => {
67
+ typeof projectHooks.BeforeAll == "function" && projectHooks.BeforeAll()
68
+
67
69
  pomCollector();
68
-
69
- projectHooks.BeforeAll()
70
70
  });
71
71
 
72
72
  Before(async function () {
73
+
73
74
  context.vars = {};
74
75
 
75
76
  const envFilePath = path.join(
@@ -110,7 +111,7 @@ Before(async function () {
110
111
  });
111
112
  }
112
113
 
113
- projectHooks.Before()
114
+ typeof projectHooks.Before == "function" && projectHooks.Before();
114
115
  });
115
116
 
116
117
  BeforeStep(({ pickleStep }) => {
@@ -118,18 +119,20 @@ BeforeStep(({ pickleStep }) => {
118
119
  context.response = {};
119
120
  }
120
121
 
121
- projectHooks.BeforeStep()
122
+ typeof projectHooks.BeforeStep == "function" && projectHooks.BeforeStep()
122
123
  });
123
124
 
124
125
  AfterStep(async function ({ pickleStep }) {
126
+ typeof projectHooks.AfterStep == "function" && projectHooks.AfterStep()
127
+
125
128
  if (HTTP_METHODS.some((method) => pickleStep.text.includes(method))) {
126
129
  await attachResponse(this.attach);
127
130
  }
128
-
129
- projectHooks.AfterStep()
130
131
  });
131
132
 
132
133
  After(async function ({ pickle, result }) {
134
+ typeof projectHooks.After == "function" && projectHooks.After()
135
+
133
136
  const shouldReport =
134
137
  (cucumberConfig.default.successReport ||
135
138
  result?.status !== Status.PASSED) &&
@@ -211,10 +214,11 @@ After(async function ({ pickle, result }) {
211
214
  }
212
215
  }
213
216
 
214
- projectHooks.After()
215
217
  });
216
218
 
217
219
  AfterAll(() => {
220
+ typeof projectHooks.AfterAll == "function" && projectHooks.AfterAll()
221
+
218
222
  if (!fs.existsSync(statusDir)) return;
219
223
 
220
224
  const files = fs.readdirSync(statusDir);
@@ -238,6 +242,4 @@ AfterAll(() => {
238
242
  fs.writeFileSync(path.join(process.cwd(), "EXIT_CODE.txt"), "1");
239
243
  }
240
244
  }
241
-
242
- projectHooks.AfterAll()
243
245
  });