vest 5.0.5 → 5.1.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/dist/cjs/vest.development.js +16 -6
- package/dist/cjs/vest.development.js.map +1 -1
- package/dist/cjs/vest.production.js +1 -1
- package/dist/cjs/vest.production.js.map +1 -1
- package/dist/es/vest.development.js +16 -6
- package/dist/es/vest.development.js.map +1 -1
- package/dist/es/vest.production.js +1 -1
- package/dist/es/vest.production.js.map +1 -1
- package/dist/umd/vest.development.js +16 -6
- package/dist/umd/vest.development.js.map +1 -1
- package/dist/umd/vest.production.js +1 -1
- package/dist/umd/vest.production.js.map +1 -1
- package/package.json +6 -6
- package/types/SuiteSerializer.d.ts +7 -1
- package/types/SuiteSerializer.d.ts.map +1 -1
- package/types/classnames.d.ts +6 -1
- package/types/classnames.d.ts.map +1 -1
- package/types/parser.d.ts +6 -1
- package/types/parser.d.ts.map +1 -1
- package/types/promisify.d.ts +6 -1
- package/types/promisify.d.ts.map +1 -1
- package/types/vest.d.ts +7 -1
- package/types/vest.d.ts.map +1 -1
|
@@ -365,6 +365,7 @@ class VestTest {
|
|
|
365
365
|
}
|
|
366
366
|
static cancel(test) {
|
|
367
367
|
VestTest.setStatus(test, TestStatus.CANCELED);
|
|
368
|
+
VestTest.getData(test).abortController.abort(TestStatus.CANCELED);
|
|
368
369
|
}
|
|
369
370
|
static omit(test) {
|
|
370
371
|
VestTest.setStatus(test, TestStatus.OMITTED);
|
|
@@ -533,7 +534,7 @@ function useRunDoneCallbacks() {
|
|
|
533
534
|
vestUtils.callEach(doneCallbacks);
|
|
534
535
|
}
|
|
535
536
|
|
|
536
|
-
// eslint-disable-next-line max-statements
|
|
537
|
+
// eslint-disable-next-line max-statements, max-lines-per-function
|
|
537
538
|
function useInitVestBus() {
|
|
538
539
|
const VestBus = vestjsRuntime.Bus.useBus();
|
|
539
540
|
// Report a the completion of a test. There may be other tests with the same
|
|
@@ -581,7 +582,14 @@ function useInitVestBus() {
|
|
|
581
582
|
on(Events.RESET_SUITE, () => {
|
|
582
583
|
useResetSuite();
|
|
583
584
|
});
|
|
584
|
-
return
|
|
585
|
+
return {
|
|
586
|
+
subscribe,
|
|
587
|
+
};
|
|
588
|
+
function subscribe(cb) {
|
|
589
|
+
return VestBus.on('*', () => {
|
|
590
|
+
cb();
|
|
591
|
+
}).off;
|
|
592
|
+
}
|
|
585
593
|
function on(event, cb) {
|
|
586
594
|
VestBus.on(event, (...args) => {
|
|
587
595
|
// This is more concise, but it might be an overkill
|
|
@@ -1438,6 +1446,7 @@ function IsolateTestBase() {
|
|
|
1438
1446
|
return {
|
|
1439
1447
|
severity: TestSeverity.Error,
|
|
1440
1448
|
status: TestStatus.UNTESTED,
|
|
1449
|
+
abortController: new AbortController(),
|
|
1441
1450
|
};
|
|
1442
1451
|
}
|
|
1443
1452
|
|
|
@@ -1464,9 +1473,9 @@ function useAttemptRunTest(testObject) {
|
|
|
1464
1473
|
function runSyncTest(testObject) {
|
|
1465
1474
|
return SuiteContext.run({ currentTest: testObject }, () => {
|
|
1466
1475
|
let result;
|
|
1467
|
-
const { message, testFn } = VestTest.getData(testObject);
|
|
1476
|
+
const { message, testFn, abortController } = VestTest.getData(testObject);
|
|
1468
1477
|
try {
|
|
1469
|
-
result = testFn();
|
|
1478
|
+
result = testFn({ signal: abortController.signal });
|
|
1470
1479
|
}
|
|
1471
1480
|
catch (error) {
|
|
1472
1481
|
if (shouldUseErrorAsMessage(message, error)) {
|
|
@@ -1687,11 +1696,12 @@ function createSuite(...args) {
|
|
|
1687
1696
|
// We do this within the VestRuntime so that the suite methods
|
|
1688
1697
|
// will be bound to the suite's stateRef and be able to access it.
|
|
1689
1698
|
return vestjsRuntime.VestRuntime.Run(stateRef, () => {
|
|
1690
|
-
|
|
1699
|
+
// @vx-allow use-use
|
|
1700
|
+
const VestBus = useInitVestBus();
|
|
1691
1701
|
return vestUtils.assign(
|
|
1692
1702
|
// We're also binding the suite to the stateRef, so that the suite
|
|
1693
1703
|
// can access the stateRef when it's called.
|
|
1694
|
-
vestjsRuntime.VestRuntime.persist(suite), Object.assign(Object.assign({ dump: vestjsRuntime.VestRuntime.persist(() => vestjsRuntime.VestRuntime.
|
|
1704
|
+
vestjsRuntime.VestRuntime.persist(suite), Object.assign(Object.assign({ dump: vestjsRuntime.VestRuntime.persist(() => vestjsRuntime.VestRuntime.useAvailableRoot()), get: vestjsRuntime.VestRuntime.persist(useCreateSuiteResult), remove: vestjsRuntime.Bus.usePrepareEmitter(Events.REMOVE_FIELD), reset: vestjsRuntime.Bus.usePrepareEmitter(Events.RESET_SUITE), resetField: vestjsRuntime.Bus.usePrepareEmitter(Events.RESET_FIELD), resume: vestjsRuntime.VestRuntime.persist(useLoadSuite), subscribe: VestBus.subscribe }, bindSuiteSelectors(vestjsRuntime.VestRuntime.persist(useCreateSuiteResult))), getTypedMethods()));
|
|
1695
1705
|
});
|
|
1696
1706
|
}
|
|
1697
1707
|
function useRunSuiteCallback(suiteCallback, ...args) {
|