artes 1.2.2 → 1.2.3

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 +21 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -63,8 +63,10 @@ if (fs.existsSync(projectHooksPath)) {
63
63
 
64
64
  /* ------------------- Hooks ------------------- */
65
65
 
66
- BeforeAll(() => {
67
- typeof projectHooks.BeforeAll == "function" && projectHooks.BeforeAll()
66
+ BeforeAll(async () => {
67
+ if (typeof projectHooks.BeforeAll === "function") {
68
+ await projectHooks.BeforeAll();
69
+ }
68
70
 
69
71
  pomCollector();
70
72
  });
@@ -111,19 +113,25 @@ Before(async function () {
111
113
  });
112
114
  }
113
115
 
114
- typeof projectHooks.Before == "function" && projectHooks.Before();
116
+ if (typeof projectHooks.Before === "function") {
117
+ await projectHooks.Before();
118
+ }
115
119
  });
116
120
 
117
- BeforeStep(({ pickleStep }) => {
121
+ BeforeStep(async ({ pickleStep }) => {
118
122
  if (HTTP_METHODS.some((method) => pickleStep.text.includes(method))) {
119
123
  context.response = {};
120
124
  }
121
125
 
122
- typeof projectHooks.BeforeStep == "function" && projectHooks.BeforeStep()
126
+ if (typeof projectHooks.BeforeStep === "function") {
127
+ await projectHooks.BeforeStep();
128
+ }
123
129
  });
124
130
 
125
131
  AfterStep(async function ({ pickleStep }) {
126
- typeof projectHooks.AfterStep == "function" && projectHooks.AfterStep()
132
+ if (typeof projectHooks.AfterStep === "function") {
133
+ await projectHooks.AfterStep();
134
+ }
127
135
 
128
136
  if (HTTP_METHODS.some((method) => pickleStep.text.includes(method))) {
129
137
  await attachResponse(this.attach);
@@ -131,7 +139,9 @@ AfterStep(async function ({ pickleStep }) {
131
139
  });
132
140
 
133
141
  After(async function ({ pickle, result }) {
134
- typeof projectHooks.After == "function" && projectHooks.After()
142
+ if (typeof projectHooks.After === "function") {
143
+ await projectHooks.After();
144
+ }
135
145
 
136
146
  const shouldReport =
137
147
  (cucumberConfig.default.successReport ||
@@ -216,8 +226,10 @@ After(async function ({ pickle, result }) {
216
226
 
217
227
  });
218
228
 
219
- AfterAll(() => {
220
- typeof projectHooks.AfterAll == "function" && projectHooks.AfterAll()
229
+ AfterAll(async () => {
230
+ if (typeof projectHooks.AfterAll === "function") {
231
+ await projectHooks.AfterAll();
232
+ }
221
233
 
222
234
  if (!fs.existsSync(statusDir)) return;
223
235