@sprucelabs/test-utils 5.5.9 → 5.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.
- package/build/decorators.js +6 -4
- package/build/esm/decorators.js +6 -5
- package/package.json +1 -1
package/build/decorators.js
CHANGED
@@ -90,12 +90,14 @@ function hookupTestClassToJestLifecycle(Target) {
|
|
90
90
|
});
|
91
91
|
}
|
92
92
|
async function runBeforeAll(Target) {
|
93
|
-
|
94
|
-
await cb?.apply?.(Target.constructor);
|
93
|
+
await callStaticHook(Target, 'beforeAll');
|
95
94
|
}
|
96
95
|
async function runAfterAll(Target) {
|
97
|
-
|
98
|
-
|
96
|
+
await callStaticHook(Target, 'afterAll');
|
97
|
+
}
|
98
|
+
async function callStaticHook(Target, hook) {
|
99
|
+
const cb = resolveMethod(Target, hook);
|
100
|
+
await cb?.apply?.(SpruceTestResolver_1.default.ActiveTestClass ? Target.constructor : Target);
|
99
101
|
}
|
100
102
|
async function runAfterEach(Target) {
|
101
103
|
if (SpruceTestResolver_1.default.ActiveTestClass) {
|
package/build/esm/decorators.js
CHANGED
@@ -53,14 +53,15 @@ function hookupTestClassToJestLifecycle(Target) {
|
|
53
53
|
});
|
54
54
|
}
|
55
55
|
async function runBeforeAll(Target) {
|
56
|
-
|
57
|
-
const cb = resolveMethod(Target, 'beforeAll');
|
58
|
-
await ((_a = cb === null || cb === void 0 ? void 0 : cb.apply) === null || _a === void 0 ? void 0 : _a.call(cb, Target.constructor));
|
56
|
+
await callStaticHook(Target, 'beforeAll');
|
59
57
|
}
|
60
58
|
async function runAfterAll(Target) {
|
59
|
+
await callStaticHook(Target, 'afterAll');
|
60
|
+
}
|
61
|
+
async function callStaticHook(Target, hook) {
|
61
62
|
var _a;
|
62
|
-
const cb = resolveMethod(Target,
|
63
|
-
await ((_a = cb === null || cb === void 0 ? void 0 : cb.apply) === null || _a === void 0 ? void 0 : _a.call(cb, Target.constructor));
|
63
|
+
const cb = resolveMethod(Target, hook);
|
64
|
+
await ((_a = cb === null || cb === void 0 ? void 0 : cb.apply) === null || _a === void 0 ? void 0 : _a.call(cb, SpruceTestResolver.ActiveTestClass ? Target.constructor : Target));
|
64
65
|
}
|
65
66
|
async function runAfterEach(Target) {
|
66
67
|
var _a, _b, _c, _d, _e;
|