vest 5.3.0 → 5.3.1-dev-20240617-b233
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/classnames.development.js.map +1 -1
- package/dist/cjs/classnames.production.js.map +1 -1
- package/dist/cjs/debounce.development.js +1 -1
- package/dist/cjs/debounce.development.js.map +1 -1
- package/dist/cjs/debounce.production.js +1 -1
- package/dist/cjs/debounce.production.js.map +1 -1
- package/dist/cjs/parser.development.js +1 -1
- package/dist/cjs/parser.development.js.map +1 -1
- package/dist/cjs/parser.production.js +1 -1
- package/dist/cjs/parser.production.js.map +1 -1
- package/dist/cjs/vest.development.js +15 -7
- 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/classnames.development.js.map +1 -1
- package/dist/es/classnames.production.js.map +1 -1
- package/dist/es/debounce.development.js +1 -1
- package/dist/es/debounce.development.js.map +1 -1
- package/dist/es/debounce.production.js +1 -1
- package/dist/es/debounce.production.js.map +1 -1
- package/dist/es/parser.development.js +1 -1
- package/dist/es/parser.development.js.map +1 -1
- package/dist/es/parser.production.js +1 -1
- package/dist/es/parser.production.js.map +1 -1
- package/dist/es/vest.development.js +16 -8
- 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/classnames.development.js.map +1 -1
- package/dist/umd/classnames.production.js.map +1 -1
- package/dist/umd/debounce.development.js +4 -4
- package/dist/umd/debounce.development.js.map +1 -1
- package/dist/umd/debounce.production.js +1 -1
- package/dist/umd/debounce.production.js.map +1 -1
- package/dist/umd/parser.development.js +4 -4
- package/dist/umd/parser.development.js.map +1 -1
- package/dist/umd/parser.production.js +1 -1
- package/dist/umd/parser.production.js.map +1 -1
- package/dist/umd/vest.development.js +15 -7
- 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 +6 -2
- package/types/SuiteSerializer.d.ts.map +1 -1
- package/types/debounce.d.ts.map +1 -1
- package/types/vest.d.ts +6 -2
- package/types/vest.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classnames.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/parser.ts","../../src/exports/classnames.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import {
|
|
1
|
+
{"version":3,"file":"classnames.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/parser.ts","../../src/exports/classnames.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { suiteSelectors } from 'vest';\n\nexport function parse<F extends TFieldName, G extends TGroupName>(\n summary: SuiteSummary<F, G>,\n): ParsedVestObject<F> {\n invariant(\n summary && hasOwnProperty(summary, 'valid'),\n ErrorStrings.PARSER_EXPECT_RESULT_OBJECT,\n );\n\n const sel = suiteSelectors(summary);\n\n const testedStorage: Record<string, boolean> = {};\n\n const selectors = {\n invalid: sel.hasErrors,\n pending: sel.isPending,\n tested: isTested,\n untested: isUntested,\n valid: sel.isValid,\n warning: sel.hasWarnings,\n };\n\n return selectors;\n\n // Booleans\n function isTested(fieldName?: F): boolean {\n if (isNullish(fieldName)) {\n return isPositive(summary.testCount);\n }\n\n if (hasOwnProperty(testedStorage, fieldName)) {\n return testedStorage[fieldName];\n }\n\n addFieldToTestedStorage(fieldName);\n\n return selectors.tested(fieldName);\n }\n\n function addFieldToTestedStorage(fieldName: F): void {\n testedStorage[fieldName] =\n hasOwnProperty(summary.tests, fieldName) &&\n isPositive(summary.tests[fieldName].testCount);\n }\n\n function isUntested(fieldName?: F): boolean {\n return !(isPositive(summary.testCount) && selectors.tested(fieldName));\n }\n}\n\nexport type ParsedVestObject<F extends TFieldName> = {\n valid(fieldName?: F): boolean;\n tested(fieldName?: F): boolean;\n invalid(fieldName?: F): boolean;\n untested(fieldName?: F): boolean;\n warning(fieldName?: F): boolean;\n pending(fieldName?: F): boolean;\n};\n","import { isFunction } from 'vest-utils';\n\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { ParsedVestObject, parse } from 'parser';\n\n/**\n * Creates a function that returns class names that match the validation result\n */\nexport default function classnames<F extends TFieldName, G extends TGroupName>(\n res: SuiteSummary<F, G>,\n classes: SupportedClasses = {}\n): (fieldName: F) => string {\n const selectors = parse(res);\n\n return function cn(fieldName: F): string {\n const classesArray: string[] = [];\n\n for (const selector in classes) {\n const sel = selector as keyof SupportedClasses;\n if (isFunction(selectors[sel]) && selectors[sel](fieldName)) {\n classesArray.push(classes[sel] as string);\n }\n }\n\n return classesArray.join(' ');\n };\n}\n\ntype SupportedClasses = {\n [K in keyof ParsedVestObject<TFieldName>]?: string;\n};\n"],"names":["invariant","hasOwnProperty","suiteSelectors","isNullish","isPositive","is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,EAAE;YAC9B,MAAM,GAAG,GAAG,QAAkC,CAAC;AAC/C,YAAA,IAAIC,oBAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,EAAE;gBAC3D,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAW,CAAC,CAAC;AAC3C,aAAA;AACF,SAAA;AAED,QAAA,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChC,KAAC,CAAC;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classnames.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/classnames.ts","../../src/exports/parser.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import { isFunction } from 'vest-utils';\n\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { ParsedVestObject, parse } from 'parser';\n\n/**\n * Creates a function that returns class names that match the validation result\n */\nexport default function classnames<F extends TFieldName, G extends TGroupName>(\n res: SuiteSummary<F, G>,\n classes: SupportedClasses = {}\n): (fieldName: F) => string {\n const selectors = parse(res);\n\n return function cn(fieldName: F): string {\n const classesArray: string[] = [];\n\n for (const selector in classes) {\n const sel = selector as keyof SupportedClasses;\n if (isFunction(selectors[sel]) && selectors[sel](fieldName)) {\n classesArray.push(classes[sel] as string);\n }\n }\n\n return classesArray.join(' ');\n };\n}\n\ntype SupportedClasses = {\n [K in keyof ParsedVestObject<TFieldName>]?: string;\n};\n","import {
|
|
1
|
+
{"version":3,"file":"classnames.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/classnames.ts","../../src/exports/parser.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import { isFunction } from 'vest-utils';\n\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { ParsedVestObject, parse } from 'parser';\n\n/**\n * Creates a function that returns class names that match the validation result\n */\nexport default function classnames<F extends TFieldName, G extends TGroupName>(\n res: SuiteSummary<F, G>,\n classes: SupportedClasses = {}\n): (fieldName: F) => string {\n const selectors = parse(res);\n\n return function cn(fieldName: F): string {\n const classesArray: string[] = [];\n\n for (const selector in classes) {\n const sel = selector as keyof SupportedClasses;\n if (isFunction(selectors[sel]) && selectors[sel](fieldName)) {\n classesArray.push(classes[sel] as string);\n }\n }\n\n return classesArray.join(' ');\n };\n}\n\ntype SupportedClasses = {\n [K in keyof ParsedVestObject<TFieldName>]?: string;\n};\n","import { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { suiteSelectors } from 'vest';\n\nexport function parse<F extends TFieldName, G extends TGroupName>(\n summary: SuiteSummary<F, G>,\n): ParsedVestObject<F> {\n invariant(\n summary && hasOwnProperty(summary, 'valid'),\n ErrorStrings.PARSER_EXPECT_RESULT_OBJECT,\n );\n\n const sel = suiteSelectors(summary);\n\n const testedStorage: Record<string, boolean> = {};\n\n const selectors = {\n invalid: sel.hasErrors,\n pending: sel.isPending,\n tested: isTested,\n untested: isUntested,\n valid: sel.isValid,\n warning: sel.hasWarnings,\n };\n\n return selectors;\n\n // Booleans\n function isTested(fieldName?: F): boolean {\n if (isNullish(fieldName)) {\n return isPositive(summary.testCount);\n }\n\n if (hasOwnProperty(testedStorage, fieldName)) {\n return testedStorage[fieldName];\n }\n\n addFieldToTestedStorage(fieldName);\n\n return selectors.tested(fieldName);\n }\n\n function addFieldToTestedStorage(fieldName: F): void {\n testedStorage[fieldName] =\n hasOwnProperty(summary.tests, fieldName) &&\n isPositive(summary.tests[fieldName].testCount);\n }\n\n function isUntested(fieldName?: F): boolean {\n return !(isPositive(summary.testCount) && selectors.tested(fieldName));\n }\n}\n\nexport type ParsedVestObject<F extends TFieldName> = {\n valid(fieldName?: F): boolean;\n tested(fieldName?: F): boolean;\n invalid(fieldName?: F): boolean;\n untested(fieldName?: F): boolean;\n warning(fieldName?: F): boolean;\n pending(fieldName?: F): boolean;\n};\n"],"names":["ErrorStrings","res","classes","selectors","summary","invariant","hasOwnProperty","PARSER_EXPECT_RESULT_OBJECT","sel","suiteSelectors","testedStorage","invalid","hasErrors","pending","isPending","tested","fieldName","isNullish","isPositive","testCount","addFieldToTestedStorage","untested","valid","isValid","warning","hasWarnings","tests","parse","classesArray","selector","isFunction","push","join"],"mappings":"iBAAYA,6CAAZ,SAAYA,GACVA,EAAA,oBAAA,0CACAA,EAAA,mBAAA,kDACAA,EAAA,oBAAA,4BACAA,EAAA,wCAAA,4CACAA,EAAA,2BAAA,gDACAA,EAAA,4BAAA,2EACAA,EAAA,8BAAA,8DACAA,EAAA,iCAAA,sCACAA,EAAA,iCAAA,yFACAA,EAAA,gCAAA,wZAMAA,EAAA,mCAAA,+KAIAA,EAAA,0BAAA,wIAEAA,EAAA,aAAA,gDACD,CAvBD,CAAYA,IAAAA,EAuBX,CAAA,mBCfuB,SACtBC,EACAC,EAA4B,IAE5B,MAAMC,ECNF,SACJC,GAEAC,EAASA,UACPD,GAAWE,iBAAeF,EAAS,SACnCJ,EAAaO,6BAGf,MAAMC,EAAMC,iBAAeL,GAErBM,EAAyC,CAAA,EAEzCP,EAAY,CAChBQ,QAASH,EAAII,UACbC,QAASL,EAAIM,UACbC,OASF,SAAkBC,GAChB,OAAIC,EAAAA,UAAUD,GACLE,EAAUA,WAACd,EAAQe,WAGxBb,EAAcA,eAACI,EAAeM,GACzBN,EAAcM,IAGvBI,EAAwBJ,GAEjBb,EAAUY,OAAOC,GACzB,EApBCK,SA4BF,SAAoBL,GAClB,QAASE,EAAAA,WAAWd,EAAQe,YAAchB,EAAUY,OAAOC,GAC5D,EA7BCM,MAAOd,EAAIe,QACXC,QAAShB,EAAIiB,aAGf,OAAOtB,EAiBP,SAASiB,EAAwBJ,GAC/BN,EAAcM,GACZV,iBAAeF,EAAQsB,MAAOV,IAC9BE,EAAAA,WAAWd,EAAQsB,MAAMV,GAAWG,UACvC,CAKH,CDzCoBQ,CAAM1B,GAExB,OAAO,SAAYe,GACjB,MAAMY,EAAyB,GAE/B,IAAK,MAAMC,KAAY3B,EAAS,CAC9B,MAAMM,EAAMqB,EACRC,EAAUA,WAAC3B,EAAUK,KAASL,EAAUK,GAAKQ,IAC/CY,EAAaG,KAAK7B,EAAQM,GAE7B,CAED,OAAOoB,EAAaI,KAAK,IAC3B,CACF"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var vest = require('vest');
|
|
6
5
|
var vestUtils = require('vest-utils');
|
|
7
6
|
var vestjsRuntime = require('vestjs-runtime');
|
|
7
|
+
var vest = require('vest');
|
|
8
8
|
|
|
9
9
|
const isolateType = 'Debounce';
|
|
10
10
|
function debounce(callback, delay = 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.development.js","sources":["../../src/exports/debounce.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"debounce.development.js","sources":["../../src/exports/debounce.ts"],"sourcesContent":["import { CB, isPromise, Nullable } from 'vest-utils';\nimport { Isolate, TIsolate, IsolateSelectors } from 'vestjs-runtime';\n\nimport { TestFn, TestFnPayload } from 'TestTypes';\nimport { registerReconciler } from 'vest';\n\nconst isolateType = 'Debounce';\n\nexport default function debounce<Callback extends CB = CB>(\n callback: Callback,\n delay: number = 0,\n): TestFn {\n let timeout: Nullable<NodeJS.Timeout> = null;\n\n const f = () => (payload: TestFnPayload) =>\n new Promise((resolve, reject) => {\n timeout = setTimeout(() => {\n let res = false;\n try {\n res = callback(payload);\n } catch (e) {\n return reject(e);\n }\n\n if (res === false) {\n return reject();\n }\n\n return isPromise(res) ? res.then(resolve, reject) : resolve(res);\n }, delay);\n });\n\n const i = Isolate.create(isolateType, f, {\n clearTimeout: () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n },\n });\n\n return i.output;\n}\n\nexport class IsolateDebounceReconciler {\n static match(currentNode: TIsolate, historyNode: TIsolate): boolean {\n return (\n IsolateSelectors.isIsolateType(currentNode, isolateType) &&\n IsolateSelectors.isIsolateType(historyNode, isolateType)\n );\n }\n\n static reconcile(current: TIsolateDebounce, history: TIsolateDebounce) {\n history?.data?.clearTimeout?.();\n\n return current;\n }\n}\n\nexport type TIsolateDebounce = TIsolate<IsolateDebouncePayload>;\n\nexport type IsolateDebouncePayload = {\n clearTimeout: () => void;\n};\n\nregisterReconciler(IsolateDebounceReconciler);\n"],"names":["isPromise","Isolate","IsolateSelectors","registerReconciler"],"mappings":";;;;;;;;AAMA,MAAM,WAAW,GAAG,UAAU,CAAC;AAEP,SAAA,QAAQ,CAC9B,QAAkB,EAClB,QAAgB,CAAC,EAAA;IAEjB,IAAI,OAAO,GAA6B,IAAI,CAAC;AAE7C,IAAA,MAAM,CAAC,GAAG,MAAM,CAAC,OAAsB,KACrC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AAC9B,QAAA,OAAO,GAAG,UAAU,CAAC,MAAK;YACxB,I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A,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAI,CAAC;AAEhC,QAAA,OAAO,OAAO,CAAC;KAChB;AACF,CAAA;AAQDC,uBAAkB,CAAC,yBAAyB,CAAC;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vest"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vest-utils"),t=require("vestjs-runtime"),r=require("vest");class o{static match(e,r){return t.IsolateSelectors.isIsolateType(e,"Debounce")&&t.IsolateSelectors.isIsolateType(r,"Debounce")}static reconcile(e,t){var r,o;return null===(o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.clearTimeout)||void 0===o||o.call(r),e}}r.registerReconciler(o),exports.IsolateDebounceReconciler=o,exports.default=function(r,o=0){let l=null;return t.Isolate.create("Debounce",(()=>t=>new Promise(((s,u)=>{l=setTimeout((()=>{let o=!1;try{o=r(t)}catch(e){return u(e)}return!1===o?u():e.isPromise(o)?o.then(s,u):s(o)}),o)}))),{clearTimeout:()=>{l&&clearTimeout(l)}}).output};
|
|
2
2
|
//# sourceMappingURL=debounce.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.production.js","sources":["../../src/exports/debounce.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"debounce.production.js","sources":["../../src/exports/debounce.ts"],"sourcesContent":["import { CB, isPromise, Nullable } from 'vest-utils';\nimport { Isolate, TIsolate, IsolateSelectors } from 'vestjs-runtime';\n\nimport { TestFn, TestFnPayload } from 'TestTypes';\nimport { registerReconciler } from 'vest';\n\nconst isolateType = 'Debounce';\n\nexport default function debounce<Callback extends CB = CB>(\n callback: Callback,\n delay: number = 0,\n): TestFn {\n let timeout: Nullable<NodeJS.Timeout> = null;\n\n const f = () => (payload: TestFnPayload) =>\n new Promise((resolve, reject) => {\n timeout = setTimeout(() => {\n let res = false;\n try {\n res = callback(payload);\n } catch (e) {\n return reject(e);\n }\n\n if (res === false) {\n return reject();\n }\n\n return isPromise(res) ? res.then(resolve, reject) : resolve(res);\n }, delay);\n });\n\n const i = Isolate.create(isolateType, f, {\n clearTimeout: () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n },\n });\n\n return i.output;\n}\n\nexport class IsolateDebounceReconciler {\n static match(currentNode: TIsolate, historyNode: TIsolate): boolean {\n return (\n IsolateSelectors.isIsolateType(currentNode, isolateType) &&\n IsolateSelectors.isIsolateType(historyNode, isolateType)\n );\n }\n\n static reconcile(current: TIsolateDebounce, history: TIsolateDebounce) {\n history?.data?.clearTimeout?.();\n\n return current;\n }\n}\n\nexport type TIsolateDebounce = TIsolate<IsolateDebouncePayload>;\n\nexport type IsolateDebouncePayload = {\n clearTimeout: () => void;\n};\n\nregisterReconciler(IsolateDebounceReconciler);\n"],"names":["IsolateDebounceReconciler","static","currentNode","historyNode","IsolateSelectors","isIsolateType","current","history","_b","_a","data","clearTimeout","call","registerReconciler","callback","delay","timeout","Isolate","create","payload","Promise","resolve","reject","setTimeout","res","e","isPromise","then","output"],"mappings":"oJA2CaA,EACXC,aAAaC,EAAuBC,GAClC,OACEC,mBAAiBC,cAAcH,EAxCjB,aAyCdE,EAAAA,iBAAiBC,cAAcF,EAzCjB,WA2CjB,CAEDF,iBAAiBK,EAA2BC,WAG1C,OAF2B,QAA3BC,EAAa,QAAbC,EAAAF,aAAO,EAAPA,EAASG,YAAI,IAAAD,OAAA,EAAAA,EAAEE,oBAAY,IAAAH,GAAAA,EAAAI,KAAAH,GAEpBH,CACR,EASHO,EAAkBA,mBAACb,uDAxDK,SACtBc,EACAC,EAAgB,GAEhB,IAAIC,EAAoC,KA4BxC,OARUC,EAAOA,QAACC,OA1BA,YAQR,IAAOC,GACf,IAAIC,SAAQ,CAACC,EAASC,KACpBN,EAAUO,YAAW,KACnB,IAAIC,GAAM,EACV,IACEA,EAAMV,EAASK,EAGhB,CAFC,MAAOM,GACP,OAAOH,EAAOG,EACf,CAED,OAAY,IAARD,EACKF,IAGFI,EAASA,UAACF,GAAOA,EAAIG,KAAKN,EAASC,GAAUD,EAAQG,EAAI,GAC/DT,EAAM,KAG4B,CACvCJ,aAAc,KACRK,GACFL,aAAaK,EACd,IAIIY,MACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/parser.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import {
|
|
1
|
+
{"version":3,"file":"parser.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/parser.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { suiteSelectors } from 'vest';\n\nexport function parse<F extends TFieldName, G extends TGroupName>(\n summary: SuiteSummary<F, G>,\n): ParsedVestObject<F> {\n invariant(\n summary && hasOwnProperty(summary, 'valid'),\n ErrorStrings.PARSER_EXPECT_RESULT_OBJECT,\n );\n\n const sel = suiteSelectors(summary);\n\n const testedStorage: Record<string, boolean> = {};\n\n const selectors = {\n invalid: sel.hasErrors,\n pending: sel.isPending,\n tested: isTested,\n untested: isUntested,\n valid: sel.isValid,\n warning: sel.hasWarnings,\n };\n\n return selectors;\n\n // Booleans\n function isTested(fieldName?: F): boolean {\n if (isNullish(fieldName)) {\n return isPositive(summary.testCount);\n }\n\n if (hasOwnProperty(testedStorage, fieldName)) {\n return testedStorage[fieldName];\n }\n\n addFieldToTestedStorage(fieldName);\n\n return selectors.tested(fieldName);\n }\n\n function addFieldToTestedStorage(fieldName: F): void {\n testedStorage[fieldName] =\n hasOwnProperty(summary.tests, fieldName) &&\n isPositive(summary.tests[fieldName].testCount);\n }\n\n function isUntested(fieldName?: F): boolean {\n return !(isPositive(summary.testCount) && selectors.tested(fieldName));\n }\n}\n\nexport type ParsedVestObject<F extends TFieldName> = {\n valid(fieldName?: F): boolean;\n tested(fieldName?: F): boolean;\n invalid(fieldName?: F): boolean;\n untested(fieldName?: F): boolean;\n warning(fieldName?: F): boolean;\n pending(fieldName?: F): boolean;\n};\n"],"names":["invariant","hasOwnProperty","suiteSelectors","isNullish","isPositive"],"mappings":";;;;;AAAA,IAAY,YAuBX,CAAA;AAvBD,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,qBAAA,CAAA,GAAA,yCAA+D,CAAA;AAC/D,IAAA,YAAA,CAAA,oBAAA,CAAA,GAAA,iDAAsE,CAAA;AACtE,IAAA,YAAA,CAAA,qBAAA,CAAA,GAAA,2BAAiD,CAAA;AACjD,IAAA,YAAA,CAAA,yCAAA,CAAA,GAAA,2CAAqF,CAAA;AACrF,IAAA,YAAA,CAAA,4BAAA,CAAA,GAAA,+CAA4E,CAAA;AAC5E,IAAA,YAAA,CAAA,6BAAA,CAAA,GAAA,0EAAwG,CAAA;AACxG,IAAA,YAAA,CAAA,+BAAA,CAAA,GAAA,6DA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,CAAC;AACjC,SAAA;QAED,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAEnC,QAAA,OAAO,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;KACpC;IAED,SAAS,uBAAuB,CAAC,SAAY,EAAA;QAC3C,aAAa,CAAC,SAAS,CAAC;AACtB,YAAAA,wBAAc,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;gBACxCG,oBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;KAClD;IAED,SAAS,UAAU,CAAC,SAAa,EAAA;AAC/B,QAAA,OAAO,EAAEA,oBAAU,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;KACxE;AACH;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t=require("vest"),s=require("vest
|
|
1
|
+
"use strict";var e,t=require("vest-utils"),s=require("vest");!function(e){e.HOOK_CALLED_OUTSIDE="hook called outside of a running suite.",e.EXPECTED_VEST_TEST="Expected value to be an instance of IsolateTest",e.FIELD_NAME_REQUIRED="Field name must be passed",e.SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION="Suite must be initialized with a function",e.PROMISIFY_REQUIRE_FUNCTION="Vest.Promisify must be called with a function",e.PARSER_EXPECT_RESULT_OBJECT="Vest parser: expected argument at position 0 to be Vest's result object.",e.WARN_MUST_BE_CALLED_FROM_TEST="Warn must be called from within the body of a test function",e.EACH_CALLBACK_MUST_BE_A_FUNCTION="Each must be called with a function",e.INVALID_PARAM_PASSED_TO_FUNCTION='Incompatible params passed to {fn_name} function. "{param}" must be of type {expected}',e.TESTS_CALLED_IN_DIFFERENT_ORDER='Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You\'re using if/else statements to conditionally select tests. Instead, use "skipWhen".\n 2. You are iterating over a list of tests, and their order changed. Use "each" and a custom key prop so that Vest retains their state.',e.UNEXPECTED_TEST_REGISTRATION_ERROR="Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.",e.UNEXPECTED_TEST_RUN_ERROR="Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.",e.INCLUDE_SELF="Trying to call include.when on the same field."}(e||(e={})),exports.parse=function(n){t.invariant(n&&t.hasOwnProperty(n,"valid"),e.PARSER_EXPECT_RESULT_OBJECT);const i=s.suiteSelectors(n),r={},o={invalid:i.hasErrors,pending:i.isPending,tested:function(e){if(t.isNullish(e))return t.isPositive(n.testCount);if(t.hasOwnProperty(r,e))return r[e];return a(e),o.tested(e)},untested:function(e){return!(t.isPositive(n.testCount)&&o.tested(e))},valid:i.isValid,warning:i.hasWarnings};return o;function a(e){r[e]=t.hasOwnProperty(n.tests,e)&&t.isPositive(n.tests[e].testCount)}};
|
|
2
2
|
//# sourceMappingURL=parser.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/parser.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import {
|
|
1
|
+
{"version":3,"file":"parser.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/parser.ts"],"sourcesContent":["export enum ErrorStrings {\n HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.',\n EXPECTED_VEST_TEST = 'Expected value to be an instance of IsolateTest',\n FIELD_NAME_REQUIRED = 'Field name must be passed',\n SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION = 'Suite must be initialized with a function',\n PROMISIFY_REQUIRE_FUNCTION = 'Vest.Promisify must be called with a function',\n PARSER_EXPECT_RESULT_OBJECT = \"Vest parser: expected argument at position 0 to be Vest's result object.\",\n WARN_MUST_BE_CALLED_FROM_TEST = 'Warn must be called from within the body of a test function',\n EACH_CALLBACK_MUST_BE_A_FUNCTION = 'Each must be called with a function',\n INVALID_PARAM_PASSED_TO_FUNCTION = 'Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}',\n TESTS_CALLED_IN_DIFFERENT_ORDER = `Vest Critical Error: Tests called in different order than previous run.\n expected: {fieldName}\n received: {prevName}\n This can happen on one of two reasons:\n 1. You're using if/else statements to conditionally select tests. Instead, use \"skipWhen\".\n 2. You are iterating over a list of tests, and their order changed. Use \"each\" and a custom key prop so that Vest retains their state.`,\n UNEXPECTED_TEST_REGISTRATION_ERROR = `Unexpected error encountered during test registration.\n Please report this issue to Vest's Github repository.\n Test Object: {testObject}.\n Error: {error}.`,\n UNEXPECTED_TEST_RUN_ERROR = `Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.`,\n INCLUDE_SELF = 'Trying to call include.when on the same field.',\n}\n","import { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { suiteSelectors } from 'vest';\n\nexport function parse<F extends TFieldName, G extends TGroupName>(\n summary: SuiteSummary<F, G>,\n): ParsedVestObject<F> {\n invariant(\n summary && hasOwnProperty(summary, 'valid'),\n ErrorStrings.PARSER_EXPECT_RESULT_OBJECT,\n );\n\n const sel = suiteSelectors(summary);\n\n const testedStorage: Record<string, boolean> = {};\n\n const selectors = {\n invalid: sel.hasErrors,\n pending: sel.isPending,\n tested: isTested,\n untested: isUntested,\n valid: sel.isValid,\n warning: sel.hasWarnings,\n };\n\n return selectors;\n\n // Booleans\n function isTested(fieldName?: F): boolean {\n if (isNullish(fieldName)) {\n return isPositive(summary.testCount);\n }\n\n if (hasOwnProperty(testedStorage, fieldName)) {\n return testedStorage[fieldName];\n }\n\n addFieldToTestedStorage(fieldName);\n\n return selectors.tested(fieldName);\n }\n\n function addFieldToTestedStorage(fieldName: F): void {\n testedStorage[fieldName] =\n hasOwnProperty(summary.tests, fieldName) &&\n isPositive(summary.tests[fieldName].testCount);\n }\n\n function isUntested(fieldName?: F): boolean {\n return !(isPositive(summary.testCount) && selectors.tested(fieldName));\n }\n}\n\nexport type ParsedVestObject<F extends TFieldName> = {\n valid(fieldName?: F): boolean;\n tested(fieldName?: F): boolean;\n invalid(fieldName?: F): boolean;\n untested(fieldName?: F): boolean;\n warning(fieldName?: F): boolean;\n pending(fieldName?: F): boolean;\n};\n"],"names":["ErrorStrings","summary","invariant","hasOwnProperty","PARSER_EXPECT_RESULT_OBJECT","sel","suiteSelectors","testedStorage","selectors","invalid","hasErrors","pending","isPending","tested","fieldName","isNullish","isPositive","testCount","addFieldToTestedStorage","untested","valid","isValid","warning","hasWarnings","tests"],"mappings":"iBAAYA,6CAAZ,SAAYA,GACVA,EAAA,oBAAA,0CACAA,EAAA,mBAAA,kDACAA,EAAA,oBAAA,4BACAA,EAAA,wCAAA,4CACAA,EAAA,2BAAA,gDACAA,EAAA,4BAAA,2EACAA,EAAA,8BAAA,8DACAA,EAAA,iCAAA,sCACAA,EAAA,iCAAA,yFACAA,EAAA,gCAAA,wZAMAA,EAAA,mCAAA,+KAIAA,EAAA,0BAAA,wIAEAA,EAAA,aAAA,gDACD,CAvBD,CAAYA,IAAAA,EAuBX,CAAA,kBCjBK,SACJC,GAEAC,EAASA,UACPD,GAAWE,iBAAeF,EAAS,SACnCD,EAAaI,6BAGf,MAAMC,EAAMC,iBAAeL,GAErBM,EAAyC,CAAA,EAEzCC,EAAY,CAChBC,QAASJ,EAAIK,UACbC,QAASN,EAAIO,UACbC,OASF,SAAkBC,GAChB,GAAIC,EAAAA,UAAUD,GACZ,OAAOE,EAAUA,WAACf,EAAQgB,WAG5B,GAAId,EAAcA,eAACI,EAAeO,GAChC,OAAOP,EAAcO,GAKvB,OAFAI,EAAwBJ,GAEjBN,EAAUK,OAAOC,EACzB,EApBCK,SA4BF,SAAoBL,GAClB,QAASE,EAAAA,WAAWf,EAAQgB,YAAcT,EAAUK,OAAOC,GAC5D,EA7BCM,MAAOf,EAAIgB,QACXC,QAASjB,EAAIkB,aAGf,OAAOf,EAiBP,SAASU,EAAwBJ,GAC/BP,EAAcO,GACZX,iBAAeF,EAAQuB,MAAOV,IAC9BE,EAAAA,WAAWf,EAAQuB,MAAMV,GAAWG,UACvC,CAKH"}
|
|
@@ -1039,9 +1039,9 @@ function useCreateSuiteResult() {
|
|
|
1039
1039
|
const summary = useProduceSuiteSummary();
|
|
1040
1040
|
// @vx-allow use-use
|
|
1041
1041
|
const suiteName = useSuiteName();
|
|
1042
|
-
return
|
|
1042
|
+
return vestUtils.freezeAssign(summary, suiteSelectors(summary), {
|
|
1043
1043
|
suiteName,
|
|
1044
|
-
})
|
|
1044
|
+
});
|
|
1045
1045
|
});
|
|
1046
1046
|
}
|
|
1047
1047
|
|
|
@@ -1716,9 +1716,9 @@ function shouldSkipDoneRegistration(callback, fieldName, output) {
|
|
|
1716
1716
|
}
|
|
1717
1717
|
|
|
1718
1718
|
function useSuiteRunResult() {
|
|
1719
|
-
return
|
|
1719
|
+
return vestUtils.freezeAssign({
|
|
1720
1720
|
done: vestjsRuntime.VestRuntime.persist(done),
|
|
1721
|
-
}, useCreateSuiteResult())
|
|
1721
|
+
}, useCreateSuiteResult());
|
|
1722
1722
|
}
|
|
1723
1723
|
/**
|
|
1724
1724
|
* Registers done callbacks.
|
|
@@ -1787,9 +1787,17 @@ function staticSuite(...createArgs) {
|
|
|
1787
1787
|
return vestUtils.assign((...args) => {
|
|
1788
1788
|
const suite = createSuite(...createArgs);
|
|
1789
1789
|
const result = suite(...args);
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1790
|
+
const resolve = new Promise(resolve => {
|
|
1791
|
+
result.done(res => {
|
|
1792
|
+
resolve(withDump(res));
|
|
1793
|
+
});
|
|
1794
|
+
});
|
|
1795
|
+
return vestUtils.freezeAssign(withDump({
|
|
1796
|
+
resolve: () => resolve,
|
|
1797
|
+
}), result);
|
|
1798
|
+
function withDump(o) {
|
|
1799
|
+
return vestUtils.assign({ dump: suite.dump }, o);
|
|
1800
|
+
}
|
|
1793
1801
|
}, Object.assign({}, getTypedMethods()));
|
|
1794
1802
|
}
|
|
1795
1803
|
|