vest 5.4.1 → 5.4.2
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 +26 -34
- 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 +26 -34
- 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 +26 -34
- 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 +2 -2
- package/types/SuiteSerializer.d.ts +6 -1
- package/types/SuiteSerializer.d.ts.map +1 -1
- package/types/vest.d.ts +6 -1
- package/types/vest.d.ts.map +1 -1
|
@@ -539,7 +539,7 @@ function useResetSuite() {
|
|
|
539
539
|
VestRuntime.reset();
|
|
540
540
|
}
|
|
541
541
|
function useLoadSuite(rootNode) {
|
|
542
|
-
VestRuntime.
|
|
542
|
+
VestRuntime.useSetHistoryRoot(rootNode);
|
|
543
543
|
useExpireSuiteResultCache();
|
|
544
544
|
}
|
|
545
545
|
|
|
@@ -1414,19 +1414,6 @@ function include(fieldName) {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
1416
|
|
|
1417
|
-
var Events;
|
|
1418
|
-
(function (Events) {
|
|
1419
|
-
Events["TEST_RUN_STARTED"] = "test_run_started";
|
|
1420
|
-
Events["TEST_COMPLETED"] = "test_completed";
|
|
1421
|
-
Events["ALL_RUNNING_TESTS_FINISHED"] = "all_running_tests_finished";
|
|
1422
|
-
Events["REMOVE_FIELD"] = "remove_field";
|
|
1423
|
-
Events["RESET_FIELD"] = "reset_field";
|
|
1424
|
-
Events["RESET_SUITE"] = "reset_suite";
|
|
1425
|
-
Events["SUITE_RUN_STARTED"] = "suite_run_started";
|
|
1426
|
-
Events["SUITE_CALLBACK_RUN_FINISHED"] = "SUITE_CALLBACK_RUN_FINISHED";
|
|
1427
|
-
Events["DONE_TEST_OMISSION_PASS"] = "DONE_TEST_OMISSION_PASS";
|
|
1428
|
-
})(Events || (Events = {}));
|
|
1429
|
-
|
|
1430
1417
|
function IsolateTest(callback, input, key) {
|
|
1431
1418
|
const payload = Object.assign(Object.assign({}, IsolateTestBase()), { fieldName: input.fieldName, testFn: input.testFn });
|
|
1432
1419
|
if (input.groupName) {
|
|
@@ -1570,7 +1557,11 @@ function useGetTestFromCache(dependencies, cacheAction) {
|
|
|
1570
1557
|
cache.invalidate(dependencies);
|
|
1571
1558
|
return cache(dependencies, cacheAction);
|
|
1572
1559
|
}
|
|
1573
|
-
|
|
1560
|
+
// FIXME(@ealush 2024-08-12): This is some kind of a hack. Instead organically letting Vest set the next
|
|
1561
|
+
// child of the isolate, we're forcing it from the outside.
|
|
1562
|
+
// Instead, an ideal solution would probably be to have test.memo be its own isolate
|
|
1563
|
+
// that just injects a historic output from a previous test run.
|
|
1564
|
+
VestRuntime.useSetNextIsolateChild(cachedValue);
|
|
1574
1565
|
return cachedValue;
|
|
1575
1566
|
}
|
|
1576
1567
|
|
|
@@ -1581,7 +1572,7 @@ function vestTest(fieldName, ...args) {
|
|
|
1581
1572
|
const groupName = useGroupName();
|
|
1582
1573
|
const testObjectInput = { fieldName, groupName, message, testFn };
|
|
1583
1574
|
// This invalidates the suite cache.
|
|
1584
|
-
Bus.useEmit(
|
|
1575
|
+
Bus.useEmit('TEST_RUN_STARTED');
|
|
1585
1576
|
return IsolateTest(useAttemptRunTest, testObjectInput, key);
|
|
1586
1577
|
}
|
|
1587
1578
|
const test = assign(vestTest, {
|
|
@@ -1646,7 +1637,7 @@ function useOmitOptionalFields() {
|
|
|
1646
1637
|
runOptionalConfig(testObject);
|
|
1647
1638
|
}
|
|
1648
1639
|
});
|
|
1649
|
-
Bus.useEmit(
|
|
1640
|
+
Bus.useEmit('DONE_TEST_OMISSION_PASS');
|
|
1650
1641
|
function verifyAndOmit(testObject) {
|
|
1651
1642
|
const { fieldName } = VestTest.getData(testObject);
|
|
1652
1643
|
if (shouldOmit.has(fieldName)) {
|
|
@@ -1688,8 +1679,8 @@ function useRunDoneCallbacks() {
|
|
|
1688
1679
|
// eslint-disable-next-line max-statements, max-lines-per-function
|
|
1689
1680
|
function useInitVestBus() {
|
|
1690
1681
|
const VestBus = Bus.useBus();
|
|
1691
|
-
on(
|
|
1692
|
-
// on(
|
|
1682
|
+
on('TEST_COMPLETED', () => { });
|
|
1683
|
+
// on("TEST_RUN_STARTED", () => {});
|
|
1693
1684
|
VestBus.on(RuntimeEvents.ISOLATE_PENDING, (isolate) => {
|
|
1694
1685
|
if (VestTest.is(isolate)) {
|
|
1695
1686
|
VestTest.setPending(isolate);
|
|
@@ -1698,7 +1689,7 @@ function useInitVestBus() {
|
|
|
1698
1689
|
});
|
|
1699
1690
|
VestBus.on(RuntimeEvents.ISOLATE_DONE, (isolate) => {
|
|
1700
1691
|
if (VestTest.is(isolate)) {
|
|
1701
|
-
VestBus.emit(
|
|
1692
|
+
VestBus.emit('TEST_COMPLETED', isolate);
|
|
1702
1693
|
}
|
|
1703
1694
|
VestIsolate.setDone(isolate);
|
|
1704
1695
|
});
|
|
@@ -1711,14 +1702,14 @@ function useInitVestBus() {
|
|
|
1711
1702
|
}
|
|
1712
1703
|
if (!SuiteWalker.useHasPending()) {
|
|
1713
1704
|
// When no more async tests are running, emit the done event
|
|
1714
|
-
VestBus.emit(
|
|
1705
|
+
VestBus.emit('ALL_RUNNING_TESTS_FINISHED');
|
|
1715
1706
|
}
|
|
1716
1707
|
});
|
|
1717
|
-
on(
|
|
1708
|
+
on('DONE_TEST_OMISSION_PASS', () => {
|
|
1718
1709
|
/* We NEED to refresh the cache here. Don't ask */
|
|
1719
1710
|
});
|
|
1720
1711
|
// Called when all the tests, including async, are done running
|
|
1721
|
-
VestBus.on(
|
|
1712
|
+
VestBus.on('ALL_RUNNING_TESTS_FINISHED', () => {
|
|
1722
1713
|
// Small optimization. We don't need to run this if there are no async tests
|
|
1723
1714
|
// The reason is that we run this function immediately after the suite callback
|
|
1724
1715
|
// is run, so if the suite is only comprised of sync tests, we don't need to
|
|
@@ -1728,30 +1719,31 @@ function useInitVestBus() {
|
|
|
1728
1719
|
}
|
|
1729
1720
|
useRunDoneCallbacks();
|
|
1730
1721
|
});
|
|
1731
|
-
on(
|
|
1722
|
+
on('RESET_FIELD', (fieldName) => {
|
|
1732
1723
|
TestWalker.resetField(fieldName);
|
|
1733
1724
|
});
|
|
1734
|
-
on(
|
|
1725
|
+
on('SUITE_RUN_STARTED', () => {
|
|
1735
1726
|
useResetCallbacks();
|
|
1736
1727
|
});
|
|
1737
|
-
on(
|
|
1728
|
+
on('SUITE_CALLBACK_RUN_FINISHED', () => {
|
|
1738
1729
|
if (!SuiteWalker.useHasPending()) {
|
|
1739
1730
|
// When no more async tests are running, emit the done event
|
|
1740
|
-
VestBus.emit(
|
|
1731
|
+
VestBus.emit('ALL_RUNNING_TESTS_FINISHED');
|
|
1741
1732
|
}
|
|
1742
1733
|
useOmitOptionalFields();
|
|
1743
1734
|
});
|
|
1744
|
-
on(
|
|
1735
|
+
on('REMOVE_FIELD', (fieldName) => {
|
|
1745
1736
|
TestWalker.removeTestByFieldName(fieldName);
|
|
1746
1737
|
});
|
|
1747
|
-
on(
|
|
1738
|
+
on('RESET_SUITE', () => {
|
|
1748
1739
|
useResetSuite();
|
|
1749
1740
|
});
|
|
1750
1741
|
return {
|
|
1751
1742
|
subscribe,
|
|
1752
1743
|
};
|
|
1753
|
-
function subscribe(
|
|
1754
|
-
|
|
1744
|
+
function subscribe(...args) {
|
|
1745
|
+
const [cb, event] = args.reverse();
|
|
1746
|
+
return VestBus.on(event !== null && event !== void 0 ? event : '*', () => {
|
|
1755
1747
|
cb();
|
|
1756
1748
|
}).off;
|
|
1757
1749
|
}
|
|
@@ -1828,7 +1820,7 @@ function createSuite(...args) {
|
|
|
1828
1820
|
return SuiteContext.run({
|
|
1829
1821
|
suiteParams: args,
|
|
1830
1822
|
}, () => {
|
|
1831
|
-
Bus.useEmit(
|
|
1823
|
+
Bus.useEmit('SUITE_RUN_STARTED');
|
|
1832
1824
|
return IsolateSuite(useRunSuiteCallback(suiteCallback, ...args));
|
|
1833
1825
|
}).output;
|
|
1834
1826
|
}
|
|
@@ -1842,14 +1834,14 @@ function createSuite(...args) {
|
|
|
1842
1834
|
return assign(
|
|
1843
1835
|
// We're also binding the suite to the stateRef, so that the suite
|
|
1844
1836
|
// can access the stateRef when it's called.
|
|
1845
|
-
VestRuntime.persist(suite), Object.assign(Object.assign({ dump: VestRuntime.persist(() => VestRuntime.useAvailableRoot()), get: VestRuntime.persist(useCreateSuiteResult), remove: Bus.usePrepareEmitter(
|
|
1837
|
+
VestRuntime.persist(suite), Object.assign(Object.assign({ dump: VestRuntime.persist(() => VestRuntime.useAvailableRoot()), get: VestRuntime.persist(useCreateSuiteResult), remove: Bus.usePrepareEmitter('REMOVE_FIELD'), reset: Bus.usePrepareEmitter('RESET_SUITE'), resetField: Bus.usePrepareEmitter('RESET_FIELD'), resume: VestRuntime.persist(useLoadSuite), runStatic: (...args) => mountedStatic(...args), subscribe: VestBus.subscribe }, bindSuiteSelectors(VestRuntime.persist(useCreateSuiteResult))), getTypedMethods()));
|
|
1846
1838
|
});
|
|
1847
1839
|
}
|
|
1848
1840
|
function useRunSuiteCallback(suiteCallback, ...args) {
|
|
1849
1841
|
const emit = Bus.useEmit();
|
|
1850
1842
|
return () => {
|
|
1851
1843
|
suiteCallback(...args);
|
|
1852
|
-
emit(
|
|
1844
|
+
emit('SUITE_CALLBACK_RUN_FINISHED');
|
|
1853
1845
|
return useSuiteRunResult();
|
|
1854
1846
|
};
|
|
1855
1847
|
}
|