@autometa/jest-executor 0.5.9 → 0.6.0
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/.turbo/turbo-test.log +5 -5
- package/CHANGELOG.md +26 -0
- package/dist/esm/index.js +296 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +296 -10
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
> @autometa/jest-executor@0.5.
|
|
2
|
+
> @autometa/jest-executor@0.5.10 test /Users/ben.aherne/Documents/GitHub/autometa/packages/jest-executor
|
|
3
3
|
> vitest run --passWithNoTests
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
RUN v1.4.0 /Users/ben.aherne/Documents/GitHub/autometa/packages/jest-executor
|
|
7
7
|
|
|
8
|
-
✓ src/timeout-selector.spec.ts (2 tests)
|
|
9
|
-
✓ src/executor.spec.ts (15 tests)
|
|
8
|
+
✓ src/timeout-selector.spec.ts (2 tests) 4ms
|
|
9
|
+
✓ src/executor.spec.ts (15 tests) 6ms
|
|
10
10
|
|
|
11
11
|
Test Files 2 passed (2)
|
|
12
12
|
Tests 17 passed (17)
|
|
13
|
-
Start at
|
|
14
|
-
Duration
|
|
13
|
+
Start at 13:56:48
|
|
14
|
+
Duration 6.00s (transform 2.24s, setup 0ms, collect 7.66s, tests 10ms, environment 0ms, prepare 2.38s)
|
|
15
15
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @autometa/jest-executor
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7440e9f: feat: new group based hooks for feature, rule, outline and examples
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [7440e9f]
|
|
12
|
+
- @autometa/test-builder@0.4.0
|
|
13
|
+
- @autometa/gherkin@0.7.0
|
|
14
|
+
- @autometa/events@0.3.0
|
|
15
|
+
- @autometa/scopes@0.7.0
|
|
16
|
+
- @autometa/app@0.4.0
|
|
17
|
+
- @autometa/config@0.1.25
|
|
18
|
+
|
|
19
|
+
## 0.5.10
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [205ee3b]
|
|
24
|
+
- @autometa/gherkin@0.6.15
|
|
25
|
+
- @autometa/events@0.2.27
|
|
26
|
+
- @autometa/scopes@0.6.6
|
|
27
|
+
- @autometa/test-builder@0.3.8
|
|
28
|
+
|
|
3
29
|
## 0.5.9
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -52,6 +52,10 @@ function chooseTimeout(timeout1, timeout2) {
|
|
|
52
52
|
// src/executor.ts
|
|
53
53
|
import { NullTimeout as NullTimeout2, Timeout as Timeout2 } from "@autometa/scopes";
|
|
54
54
|
import { Container, defineContainerContext } from "@autometa/injection";
|
|
55
|
+
var outlineApps = /* @__PURE__ */ new Map();
|
|
56
|
+
var examplesApps = /* @__PURE__ */ new Map();
|
|
57
|
+
var featureApps = /* @__PURE__ */ new Map();
|
|
58
|
+
var ruleApps = /* @__PURE__ */ new Map();
|
|
55
59
|
function execute({ app, world }, global, bridge, events, config) {
|
|
56
60
|
const globalBridge = new GlobalBridge(global);
|
|
57
61
|
const featureTitle = bridge.data.scope.title(bridge.data.gherkin);
|
|
@@ -97,6 +101,46 @@ function execute({ app, world }, global, bridge, events, config) {
|
|
|
97
101
|
localApp = testContainer.get(app);
|
|
98
102
|
localApp.world = testContainer.get(world);
|
|
99
103
|
localApp.di = testContainer;
|
|
104
|
+
if (!featureApps.has(name)) {
|
|
105
|
+
featureApps.set(name, []);
|
|
106
|
+
}
|
|
107
|
+
featureApps.get(name)?.push(localApp);
|
|
108
|
+
});
|
|
109
|
+
bridge.data.scope.hooks.beforeFeatureHooks.forEach((hook) => {
|
|
110
|
+
const hookTimeout = chooseTimeout(
|
|
111
|
+
chosenTimeout,
|
|
112
|
+
hook.options.timeout
|
|
113
|
+
).getTimeout(config).milliseconds;
|
|
114
|
+
beforeAll(async () => {
|
|
115
|
+
if (!hook.canExecute(...bridge.data.gherkin.tags)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const tags2 = bridge?.data?.gherkin?.tags ?? [];
|
|
119
|
+
const report = await hook.execute(staticApp, ...tags2);
|
|
120
|
+
if (report.error) {
|
|
121
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
122
|
+
throw new AutomationError(message, { cause: report.error });
|
|
123
|
+
}
|
|
124
|
+
}, hookTimeout);
|
|
125
|
+
});
|
|
126
|
+
bridge.data.scope.hooks.afterFeatureHooks.forEach((hook) => {
|
|
127
|
+
const hookTimeout = chooseTimeout(
|
|
128
|
+
chosenTimeout,
|
|
129
|
+
hook.options.timeout
|
|
130
|
+
).getTimeout(config).milliseconds;
|
|
131
|
+
afterAll(async () => {
|
|
132
|
+
if (!hook.canExecute(...bridge.data.gherkin.tags)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const testName = expect.getState().currentTestName;
|
|
136
|
+
const tags2 = bridge?.data?.gherkin?.tags ?? [];
|
|
137
|
+
const apps = featureApps.get(testName);
|
|
138
|
+
const report = await hook.execute(staticApp, apps, ...tags2);
|
|
139
|
+
if (report.error) {
|
|
140
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
141
|
+
throw new AutomationError(message, { cause: report.error });
|
|
142
|
+
}
|
|
143
|
+
}, hookTimeout);
|
|
100
144
|
});
|
|
101
145
|
bootstrapSetupHooks(globalBridge, staticApp, events, [
|
|
102
146
|
config,
|
|
@@ -153,6 +197,10 @@ function execute({ app, world }, global, bridge, events, config) {
|
|
|
153
197
|
const message = `${count} asynchronous Test Events were rejected.`;
|
|
154
198
|
console.warn(message);
|
|
155
199
|
}
|
|
200
|
+
featureApps.clear();
|
|
201
|
+
outlineApps.clear();
|
|
202
|
+
examplesApps.clear();
|
|
203
|
+
ruleApps.clear();
|
|
156
204
|
});
|
|
157
205
|
}
|
|
158
206
|
function bootstrapBackground(root, bridge, localApp, events, [config, timeout]) {
|
|
@@ -329,6 +377,7 @@ function bootstrapScenarioOutline(root, bridge, localApp, staticApp, events, [co
|
|
|
329
377
|
} = bridge;
|
|
330
378
|
const title = scope.title(gherkin);
|
|
331
379
|
const retry = [...gherkin.tags].find((tag) => tag.startsWith("@retries="));
|
|
380
|
+
const { beforeScenarioOutlineHooks, afterScenarioOutlineHooks } = scope.hooks;
|
|
332
381
|
const [group, modifier] = getGroupOrModifier(
|
|
333
382
|
bridge,
|
|
334
383
|
config.current.test?.tagFilter
|
|
@@ -337,7 +386,58 @@ function bootstrapScenarioOutline(root, bridge, localApp, staticApp, events, [co
|
|
|
337
386
|
timeout,
|
|
338
387
|
bridge.data.scope.timeout
|
|
339
388
|
).getTimeout(config).milliseconds;
|
|
389
|
+
const original = localApp;
|
|
390
|
+
localApp = () => {
|
|
391
|
+
const testName = expect.getState().currentTestName;
|
|
392
|
+
if (!outlineApps.has(testName)) {
|
|
393
|
+
outlineApps.set(testName, []);
|
|
394
|
+
}
|
|
395
|
+
const apps = outlineApps.get(testName);
|
|
396
|
+
const app = original();
|
|
397
|
+
apps.push(app);
|
|
398
|
+
return app;
|
|
399
|
+
};
|
|
340
400
|
group(title, () => {
|
|
401
|
+
beforeScenarioOutlineHooks.forEach((hook) => {
|
|
402
|
+
const hookTimeout = chooseTimeout(
|
|
403
|
+
timeout,
|
|
404
|
+
hook.options.timeout
|
|
405
|
+
).getTimeout(config).milliseconds;
|
|
406
|
+
beforeAll(async () => {
|
|
407
|
+
if (!hook.canExecute(...gherkin.tags)) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
events.beforeScenarioOutline.emitStart({
|
|
411
|
+
title,
|
|
412
|
+
modifier,
|
|
413
|
+
tags: [...gherkin.tags]
|
|
414
|
+
});
|
|
415
|
+
const tags = gherkin.tags ?? [];
|
|
416
|
+
events.beforeScenarioOutline.emitStart({
|
|
417
|
+
title,
|
|
418
|
+
modifier,
|
|
419
|
+
tags: [...gherkin.tags]
|
|
420
|
+
});
|
|
421
|
+
const report = await hook.execute(staticApp, ...tags);
|
|
422
|
+
if (report.error) {
|
|
423
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
424
|
+
events.beforeScenarioOutline.emitEnd({
|
|
425
|
+
title,
|
|
426
|
+
modifier,
|
|
427
|
+
error: report.error,
|
|
428
|
+
tags: [...gherkin.tags],
|
|
429
|
+
status: "FAILED"
|
|
430
|
+
});
|
|
431
|
+
throw new AutomationError(message, { cause: report.error });
|
|
432
|
+
}
|
|
433
|
+
events.beforeScenarioOutline.emitEnd({
|
|
434
|
+
title,
|
|
435
|
+
modifier,
|
|
436
|
+
tags: [...gherkin.tags],
|
|
437
|
+
status: "PASSED"
|
|
438
|
+
});
|
|
439
|
+
}, hookTimeout);
|
|
440
|
+
});
|
|
341
441
|
beforeAll(() => {
|
|
342
442
|
if (retry) {
|
|
343
443
|
const count = parseInt(retry.split("=")[1]);
|
|
@@ -359,6 +459,43 @@ function bootstrapScenarioOutline(root, bridge, localApp, staticApp, events, [co
|
|
|
359
459
|
});
|
|
360
460
|
bootstrapAfterHooks(root, bridge, localApp, events, [config, timeout]);
|
|
361
461
|
bootstrapTeardownHooks(bridge, staticApp, events, [config, timeout]);
|
|
462
|
+
afterScenarioOutlineHooks.forEach((hook) => {
|
|
463
|
+
const hookTimeout = chooseTimeout(
|
|
464
|
+
timeout,
|
|
465
|
+
hook.options.timeout
|
|
466
|
+
).getTimeout(config).milliseconds;
|
|
467
|
+
afterAll(async () => {
|
|
468
|
+
if (!hook.canExecute(...gherkin.tags)) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
const testName = expect.getState().currentTestName;
|
|
472
|
+
const tags = gherkin.tags ?? [];
|
|
473
|
+
const apps = outlineApps.get(testName);
|
|
474
|
+
events.afterScenarioOutline.emitStart({
|
|
475
|
+
title,
|
|
476
|
+
modifier,
|
|
477
|
+
tags: [...gherkin.tags]
|
|
478
|
+
});
|
|
479
|
+
const report = await hook.execute(staticApp, apps, ...tags);
|
|
480
|
+
if (report.error) {
|
|
481
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
482
|
+
events.scenarioOutline.emitEnd({
|
|
483
|
+
title,
|
|
484
|
+
modifier,
|
|
485
|
+
error: report.error,
|
|
486
|
+
tags: [...gherkin.tags],
|
|
487
|
+
status: "FAILED"
|
|
488
|
+
});
|
|
489
|
+
throw new AutomationError(message, { cause: report.error });
|
|
490
|
+
}
|
|
491
|
+
events.afterScenarioOutline.emitEnd({
|
|
492
|
+
title,
|
|
493
|
+
modifier,
|
|
494
|
+
tags: [...gherkin.tags],
|
|
495
|
+
status: "PASSED"
|
|
496
|
+
});
|
|
497
|
+
}, hookTimeout);
|
|
498
|
+
});
|
|
362
499
|
afterAll(() => {
|
|
363
500
|
const failures = Query.find.failed(bridge);
|
|
364
501
|
const status = getStatus(modifier, failures);
|
|
@@ -368,6 +505,8 @@ function bootstrapScenarioOutline(root, bridge, localApp, staticApp, events, [co
|
|
|
368
505
|
tags: [...gherkin.tags],
|
|
369
506
|
status
|
|
370
507
|
});
|
|
508
|
+
outlineApps.clear();
|
|
509
|
+
examplesApps.clear();
|
|
371
510
|
}, chosenTimeout);
|
|
372
511
|
});
|
|
373
512
|
}
|
|
@@ -377,6 +516,17 @@ function bootstrapExamples(root, example, localApp, staticApp, events, timeout)
|
|
|
377
516
|
const retry = [...example.data.gherkin.tags].find(
|
|
378
517
|
(tag) => tag.startsWith("@retries=")
|
|
379
518
|
);
|
|
519
|
+
const original = localApp;
|
|
520
|
+
localApp = () => {
|
|
521
|
+
const testName = expect.getState().currentTestName ?? "unnamed test";
|
|
522
|
+
if (!examplesApps.has(testName)) {
|
|
523
|
+
examplesApps.set(testName, []);
|
|
524
|
+
}
|
|
525
|
+
const apps = examplesApps.get(testName);
|
|
526
|
+
const app = original();
|
|
527
|
+
apps.push(app);
|
|
528
|
+
return app;
|
|
529
|
+
};
|
|
380
530
|
const [group] = getGroupOrModifier(
|
|
381
531
|
example,
|
|
382
532
|
timeout[0].current.test?.tagFilter
|
|
@@ -388,7 +538,62 @@ function bootstrapExamples(root, example, localApp, staticApp, events, timeout)
|
|
|
388
538
|
jest.retryTimes(count);
|
|
389
539
|
}
|
|
390
540
|
});
|
|
541
|
+
example.data.scope.hooks.beforeExamplesHooks.forEach((hook) => {
|
|
542
|
+
const hookTimeout = chooseTimeout(
|
|
543
|
+
timeout[1],
|
|
544
|
+
hook.options.timeout
|
|
545
|
+
).getTimeout(timeout[0]).milliseconds;
|
|
546
|
+
beforeAll(async () => {
|
|
547
|
+
if (!hook.canExecute(...example.data.gherkin.tags)) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
const tags = example?.data?.gherkin?.tags ?? [];
|
|
551
|
+
events.beforeExamples.emitStart({
|
|
552
|
+
title,
|
|
553
|
+
tags: [...tags]
|
|
554
|
+
});
|
|
555
|
+
const report = await hook.execute(staticApp, ...tags);
|
|
556
|
+
if (report.error) {
|
|
557
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
558
|
+
events.beforeExamples.emitEnd({
|
|
559
|
+
title,
|
|
560
|
+
error: report.error,
|
|
561
|
+
tags: [...tags],
|
|
562
|
+
status: "FAILED"
|
|
563
|
+
});
|
|
564
|
+
throw new AutomationError(message, { cause: report.error });
|
|
565
|
+
}
|
|
566
|
+
events.beforeExamples.emitEnd({
|
|
567
|
+
title,
|
|
568
|
+
tags: [...tags],
|
|
569
|
+
status: "PASSED"
|
|
570
|
+
});
|
|
571
|
+
}, hookTimeout);
|
|
572
|
+
});
|
|
391
573
|
bootstrapScenarios(root, example, localApp, staticApp, events, timeout);
|
|
574
|
+
example.data.scope.hooks.afterExamplesHooks.forEach((hook) => {
|
|
575
|
+
const hookTimeout = chooseTimeout(
|
|
576
|
+
timeout[1],
|
|
577
|
+
hook.options.timeout
|
|
578
|
+
).getTimeout(timeout[0]).milliseconds;
|
|
579
|
+
afterAll(async () => {
|
|
580
|
+
const testName = expect.getState().currentTestName;
|
|
581
|
+
if (!hook.canExecute(...example.data.gherkin.tags)) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const tags = example?.data?.gherkin?.tags ?? [];
|
|
585
|
+
const apps = examplesApps.get(testName);
|
|
586
|
+
const report = await hook.execute(staticApp, apps, ...tags);
|
|
587
|
+
if (report.error) {
|
|
588
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
589
|
+
throw new AutomationError(message, { cause: report.error });
|
|
590
|
+
}
|
|
591
|
+
}, hookTimeout);
|
|
592
|
+
});
|
|
593
|
+
afterAll(() => {
|
|
594
|
+
const testName = expect.getState().currentTestName;
|
|
595
|
+
examplesApps.delete(testName);
|
|
596
|
+
});
|
|
392
597
|
});
|
|
393
598
|
}
|
|
394
599
|
function bootstrapRules(bridge, localApp, staticApp, events, [config, timeout]) {
|
|
@@ -421,6 +626,83 @@ function bootstrapRules(bridge, localApp, staticApp, events, [config, timeout])
|
|
|
421
626
|
const count = parseInt(retry.split("=")[1]);
|
|
422
627
|
jest.retryTimes(count);
|
|
423
628
|
}
|
|
629
|
+
const original = localApp;
|
|
630
|
+
localApp = () => {
|
|
631
|
+
const testName = expect.getState().currentTestName;
|
|
632
|
+
if (!ruleApps.has(testName)) {
|
|
633
|
+
ruleApps.set(testName, []);
|
|
634
|
+
}
|
|
635
|
+
const apps = ruleApps.get(testName);
|
|
636
|
+
const app = original();
|
|
637
|
+
apps.push(app);
|
|
638
|
+
return app;
|
|
639
|
+
};
|
|
640
|
+
});
|
|
641
|
+
bridge.data.scope.hooks.beforeRuleHooks.forEach((hook) => {
|
|
642
|
+
const hookTimeout = chooseTimeout(
|
|
643
|
+
ruleTimeout,
|
|
644
|
+
hook.options.timeout
|
|
645
|
+
).getTimeout(config).milliseconds;
|
|
646
|
+
beforeAll(async () => {
|
|
647
|
+
if (!hook.canExecute(...data.gherkin.tags)) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
const tags2 = data.gherkin.tags ?? [];
|
|
651
|
+
events.beforeRule.emitStart({
|
|
652
|
+
title: `${hook.name}: ${hook.description}`,
|
|
653
|
+
tags: [...tags2]
|
|
654
|
+
});
|
|
655
|
+
const report = await hook.execute(staticApp, ...tags2);
|
|
656
|
+
if (report.error) {
|
|
657
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
658
|
+
events.beforeRule.emitEnd({
|
|
659
|
+
title: `${hook.name}: ${hook.description}`,
|
|
660
|
+
tags: [...tags2],
|
|
661
|
+
status: "FAILED",
|
|
662
|
+
error: report.error
|
|
663
|
+
});
|
|
664
|
+
throw new AutomationError(message, { cause: report.error });
|
|
665
|
+
}
|
|
666
|
+
events.beforeRule.emitEnd({
|
|
667
|
+
title: `${hook.name}: ${hook.description}`,
|
|
668
|
+
tags: [...tags2],
|
|
669
|
+
status: "PASSED"
|
|
670
|
+
});
|
|
671
|
+
}, hookTimeout);
|
|
672
|
+
});
|
|
673
|
+
bridge.data.scope.hooks.afterRuleHooks.forEach((hook) => {
|
|
674
|
+
const hookTimeout = chooseTimeout(
|
|
675
|
+
ruleTimeout,
|
|
676
|
+
hook.options.timeout
|
|
677
|
+
).getTimeout(config).milliseconds;
|
|
678
|
+
afterAll(async () => {
|
|
679
|
+
const testName = expect.getState().currentTestName;
|
|
680
|
+
if (!hook.canExecute(...data.gherkin.tags)) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const tags2 = data.gherkin.tags ?? [];
|
|
684
|
+
const apps = ruleApps.get(testName);
|
|
685
|
+
events.afterRule.emitStart({
|
|
686
|
+
title: `${hook.name}: ${hook.description}`,
|
|
687
|
+
tags: [...tags2]
|
|
688
|
+
});
|
|
689
|
+
const report = await hook.execute(staticApp, apps, ...tags2);
|
|
690
|
+
if (report.error) {
|
|
691
|
+
const message = `${hook.name}: ${hook.description} failed to execute.`;
|
|
692
|
+
events.afterRule.emitEnd({
|
|
693
|
+
title: `${hook.name}: ${hook.description}`,
|
|
694
|
+
tags: [...tags2],
|
|
695
|
+
status: "FAILED",
|
|
696
|
+
error: report.error
|
|
697
|
+
});
|
|
698
|
+
throw new AutomationError(message, { cause: report.error });
|
|
699
|
+
}
|
|
700
|
+
events.afterRule.emitEnd({
|
|
701
|
+
title: `${hook.name}: ${hook.description}`,
|
|
702
|
+
tags: [...tags2],
|
|
703
|
+
status: "PASSED"
|
|
704
|
+
});
|
|
705
|
+
}, hookTimeout);
|
|
424
706
|
});
|
|
425
707
|
bootstrapSetupHooks(rule, staticApp, events, transferTimeout);
|
|
426
708
|
bootstrapBeforeHooks(bridge, rule, localApp, events, transferTimeout);
|
|
@@ -444,6 +726,8 @@ function bootstrapRules(bridge, localApp, staticApp, events, [config, timeout])
|
|
|
444
726
|
tags: [...data.gherkin.tags],
|
|
445
727
|
status
|
|
446
728
|
});
|
|
729
|
+
const testName = expect.getState().currentTestName;
|
|
730
|
+
ruleApps.delete(testName);
|
|
447
731
|
}, ruleTimeout.milliseconds);
|
|
448
732
|
});
|
|
449
733
|
});
|
|
@@ -496,9 +780,10 @@ function bootstrapBeforeHooks(root, bridge, localApp, events, [config, timeout])
|
|
|
496
780
|
bridge.data.scope.timeout
|
|
497
781
|
).getTimeout(config);
|
|
498
782
|
bridge.data.scope.hooks.before.forEach((hook) => {
|
|
499
|
-
const hookTimeout = chooseTimeout(
|
|
500
|
-
|
|
501
|
-
|
|
783
|
+
const hookTimeout = chooseTimeout(
|
|
784
|
+
chosenTimeout,
|
|
785
|
+
hook.options.timeout
|
|
786
|
+
).getTimeout(config).milliseconds;
|
|
502
787
|
beforeEach(async () => {
|
|
503
788
|
const testName = expect.getState().currentTestName;
|
|
504
789
|
if (!testName)
|
|
@@ -541,7 +826,7 @@ function bootstrapSetupHooks(bridge, staticApp, events, [config, timeout]) {
|
|
|
541
826
|
setups.forEach((hook) => {
|
|
542
827
|
const hookTimeout = chooseTimeout(
|
|
543
828
|
Timeout2.from(chosenTimeout),
|
|
544
|
-
hook.timeout
|
|
829
|
+
hook.options.timeout
|
|
545
830
|
).getTimeout(config).milliseconds;
|
|
546
831
|
const tags = gherkin.tags ?? [];
|
|
547
832
|
beforeAll(async () => {
|
|
@@ -572,7 +857,7 @@ function bootstrapAfterHooks(root, bridge, localApp, events, [config, timeout])
|
|
|
572
857
|
scope.hooks.after.forEach((hook) => {
|
|
573
858
|
const hookTimeout = chooseTimeout(
|
|
574
859
|
Timeout2.from(chosenTimeout),
|
|
575
|
-
hook.timeout
|
|
860
|
+
hook.options.timeout
|
|
576
861
|
).getTimeout(config).milliseconds;
|
|
577
862
|
afterEach(async () => {
|
|
578
863
|
const testName = expect.getState().currentTestName;
|
|
@@ -607,15 +892,16 @@ function bootstrapAfterHooks(root, bridge, localApp, events, [config, timeout])
|
|
|
607
892
|
});
|
|
608
893
|
}
|
|
609
894
|
function bootstrapTeardownHooks(bridge, staticApp, event, [config, timeout]) {
|
|
610
|
-
const tags = bridge.data.gherkin.tags
|
|
895
|
+
const tags = [...bridge.data.gherkin.tags];
|
|
611
896
|
const { scope } = bridge.data;
|
|
612
897
|
const chosenTimeout = chooseTimeout(timeout, scope.timeout).getTimeout(
|
|
613
898
|
config
|
|
614
899
|
);
|
|
615
900
|
scope.hooks.teardown.forEach((hook) => {
|
|
616
|
-
const hookTimeout = chooseTimeout(
|
|
617
|
-
|
|
618
|
-
|
|
901
|
+
const hookTimeout = chooseTimeout(
|
|
902
|
+
chosenTimeout,
|
|
903
|
+
hook.options.timeout
|
|
904
|
+
).getTimeout(config).milliseconds;
|
|
619
905
|
afterAll(async () => {
|
|
620
906
|
if (!hook.canExecute(...tags)) {
|
|
621
907
|
return;
|
|
@@ -624,7 +910,7 @@ function bootstrapTeardownHooks(bridge, staticApp, event, [config, timeout]) {
|
|
|
624
910
|
title: `${hook.name}: ${hook.description}`,
|
|
625
911
|
tags: [...tags]
|
|
626
912
|
});
|
|
627
|
-
const report = await hook.execute(staticApp,
|
|
913
|
+
const report = await hook.execute(staticApp, tags);
|
|
628
914
|
event.teardown.emitEnd({
|
|
629
915
|
title: `${hook.name}: ${hook.description}`,
|
|
630
916
|
tags: [...tags],
|