Skip to content

Commit c3bd58a

Browse files
fixed support of multiple services (#53)
1 parent 5d15d1f commit c3bd58a

File tree

7 files changed

+58
-30
lines changed

7 files changed

+58
-30
lines changed

CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.0.22
2+
- fixed support of multiple services
3+
14
## 0.0.21
25
- added capability handle cucumber result in services
36

package-lock.json

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qavajs/cli",
3-
"version": "0.0.21",
3+
"version": "0.0.22",
44
"description": "cli for qavajs framework",
55
"scripts": {
66
"build": "tsc",
@@ -28,11 +28,11 @@
2828
"ejs": "^3.1.9",
2929
"fs-extra": "^11.1.1",
3030
"inquirer": "^8.2.5",
31-
"yargs": "^17.7.1",
31+
"yargs": "^17.7.2",
3232
"yarn-install": "^1.0.0"
3333
},
3434
"devDependencies": {
35-
"@cucumber/cucumber": "^9.1.0",
35+
"@cucumber/cucumber": "^9.1.1",
3636
"@qavajs/memory": "^1.2.1",
3737
"@types/chai": "^4.3.4",
3838
"@types/ejs": "^3.1.2",

src/ServiceHandler.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22
import importConfig from './importConfig';
3-
import {IRunResult} from '@cucumber/cucumber/api';
3+
import { IRunResult } from '@cucumber/cucumber/api';
44

55
export default class ServiceHandler {
66
private config: Promise<Config>;
@@ -42,13 +42,17 @@ export default class ServiceHandler {
4242

4343
async before() {
4444
for (const svc of await this.services) {
45-
if (svc.before) return svc.before();
45+
if (svc.before) {
46+
await svc.before();
47+
}
4648
}
4749
}
4850

4951
async after(result: IRunResult) {
5052
for (const svc of await this.services) {
51-
if (svc.after) return svc.after(result);
53+
if (svc.after) {
54+
await svc.after(result);
55+
}
5256
}
5357
}
5458
}

test-e2e-cjs/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ module.exports = {
1111
parallel: 1,
1212
publishQuiet: true,
1313
service: [{
14+
before() {
15+
console.log('service 1 started');
16+
},
17+
}, {
18+
before() {
19+
console.log('service 2 started');
20+
},
1421
after(result) {
1522
console.log(result.success);
1623
}

test-e2e-esm/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ export default {
1010
parallel: 1,
1111
publishQuiet: true,
1212
service: [{
13+
before() {
14+
console.log('service 1 started');
15+
},
16+
}, {
17+
before() {
18+
console.log('service 2 started');
19+
},
1320
after(result) {
1421
console.log(result.success);
1522
}

test-e2e-ts/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ export default {
1111
parallel: 1,
1212
publishQuiet: true,
1313
service: [{
14+
before() {
15+
console.log('service 1 started');
16+
},
17+
}, {
18+
before() {
19+
console.log('service 2 started');
20+
},
1421
after(result: IRunResult) {
1522
console.log(result.success);
1623
}

0 commit comments

Comments
 (0)