vest 5.4.0 → 5.4.1-dev-20240807-42bc
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/SuiteSerializer.production.js.map +1 -1
- 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/promisify.development.js.map +1 -1
- package/dist/cjs/promisify.production.js.map +1 -1
- package/dist/cjs/vest.development.js +41 -26
- 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/SuiteSerializer.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/promisify.development.js.map +1 -1
- package/dist/es/promisify.production.js.map +1 -1
- package/dist/es/vest.development.js +42 -27
- 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/SuiteSerializer.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/promisify.development.js.map +1 -1
- package/dist/umd/promisify.production.js.map +1 -1
- package/dist/umd/vest.development.js +41 -26
- 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.map +1 -1
- package/types/debounce.d.ts.map +1 -1
- package/types/vest.d.ts.map +1 -1
- package/vitest.config.ts +95 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuiteSerializer.production.js","sources":["../../src/exports/SuiteSerializer.ts"],"sourcesContent":["import { CB } from 'vest-utils';\nimport { IsolateSerializer } from 'vestjs-runtime';\n\nimport { TIsolateSuite } from 'IsolateSuite';\nimport { TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { Suite } from 'SuiteTypes';\n\nexport type Dumpable = {\n dump: CB<TIsolateSuite>;\n};\n\nexport class SuiteSerializer {\n static serialize(suite: Dumpable) {\n const dump = { ...suite.dump(), output: undefined };\n\n return IsolateSerializer.serialize(dump);\n }\n\n static deserialize(\n serialized: string | TIsolateSuite | Record<string, any>,\n ): TIsolateSuite {\n return IsolateSerializer.deserialize(serialized) as TIsolateSuite;\n }\n\n static resume(\n suite: Suite<TFieldName, TGroupName>,\n root: string | TIsolateSuite | Record<string, any>,\n ): void {\n const suiteRoot = SuiteSerializer.deserialize(root);\n\n suite.resume(suiteRoot);\n }\n}\n"],"names":["SuiteSerializer","
|
|
1
|
+
{"version":3,"file":"SuiteSerializer.production.js","sources":["../../src/exports/SuiteSerializer.ts"],"sourcesContent":["import { CB } from 'vest-utils';\nimport { IsolateSerializer } from 'vestjs-runtime';\n\nimport { TIsolateSuite } from 'IsolateSuite';\nimport { TFieldName, TGroupName } from 'SuiteResultTypes';\nimport { Suite } from 'SuiteTypes';\n\nexport type Dumpable = {\n dump: CB<TIsolateSuite>;\n};\n\nexport class SuiteSerializer {\n static serialize(suite: Dumpable) {\n const dump = { ...suite.dump(), output: undefined };\n\n return IsolateSerializer.serialize(dump);\n }\n\n static deserialize(\n serialized: string | TIsolateSuite | Record<string, any>,\n ): TIsolateSuite {\n return IsolateSerializer.deserialize(serialized) as TIsolateSuite;\n }\n\n static resume(\n suite: Suite<TFieldName, TGroupName>,\n root: string | TIsolateSuite | Record<string, any>,\n ): void {\n const suiteRoot = SuiteSerializer.deserialize(root);\n\n suite.resume(suiteRoot);\n }\n}\n"],"names":["SuiteSerializer","serialize","suite","dump","Object","assign","output","undefined","IsolateSerializer","deserialize","serialized","resume","root","suiteRoot"],"mappings":"mDAWaA,EACX,gBAAOC,CAAUC,GACf,MAAMC,EAAYC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAH,EAAMC,QAAM,CAAEG,YAAQC,IAExC,OAAOC,EAAiBA,kBAACP,UAAUE,EACpC,CAED,kBAAOM,CACLC,GAEA,OAAOF,EAAiBA,kBAACC,YAAYC,EACtC,CAED,aAAOC,CACLT,EACAU,GAEA,MAAMC,EAAYb,EAAgBS,YAAYG,GAE9CV,EAAMS,OAAOE,EACd"}
|
|
@@ -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 { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\
|
|
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 { suiteSelectors } from 'vest';\nimport { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\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","isFunction"],"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,6DAA6F,CAAA;AAC7F,IAAA,YAAA,CAAA,kCAAA,CAAA,GAAA,qCAAwE,CAAA;AACxE,IAAA,YAAA,CAAA,kCAAA,CAAA,GAAA,0FAA2H,CAAA;AAC3H,IAAA,YAAA,CAAA,iCAAA,CAAA,GAAA,0ZAKyI,CAAA;AACzI,IAAA,YAAA,CAAA,oCAAA,CAAA,GAAA,8KAGoB,CAAA;AACpB,IAAA,YAAA,CAAA,2BAAA,CAAA,GAAA,uIAC+B,CAAA;AAC/B,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,gDAA+D,CAAA;AACjE,CAAC,EAvBW,YAAY,KAAZ,YAAY,GAuBvB,EAAA,CAAA,CAAA;;ACjBK,SAAU,KAAK,CACnB,OAA2B,EAAA;AAE3B,IAAAA,mBAAS,CACP,OAAO,IAAIC,wBAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EAC3C,YAAY,CAAC,2BAA2B,CACzC,CAAC;AAEF,IAAA,MAAM,GAAG,GAAGC,mBAAc,CAAC,OAAO,CAAC,CAAC;IAEpC,MAAM,aAAa,GAA4B,EAAE,CAAC;AAElD,IAAA,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,GAAG,CAAC,SAAS;QACtB,OAAO,EAAE,GAAG,CAAC,SAAS;AACtB,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,GAAG,CAAC,OAAO;QAClB,OAAO,EAAE,GAAG,CAAC,WAAW;KACzB,CAAC;AAEF,IAAA,OAAO,SAAS,CAAC;;IAGjB,SAAS,QAAQ,CAAC,SAAa,EAAA;AAC7B,QAAA,IAAIC,mBAAS,CAAC,SAAS,CAAC,EAAE;AACxB,YAAA,OAAOC,oBAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACtC,SAAA;AAED,QAAA,IAAIH,wBAAc,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE;AAC5C,YAAA,OAAO,aAAa,CAAC,SAAS,CAAC,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;;AChDA;;AAEG;AACqB,SAAA,UAAU,CAChC,GAAuB,EACvB,UAA4B,EAAE,EAAA;AAE9B,IAAA,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAE7B,OAAO,SAAS,EAAE,CAAC,SAAY,EAAA;QAC7B,MAAM,YAAY,GAAa,EAAE,CAAC;AAElC,QAAA,KAAK,MAAM,QAAQ,IAAI,OAAO,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 = {}
|
|
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 { suiteSelectors } from 'vest';\nimport { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\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');
|
|
5
6
|
var vestUtils = require('vest-utils');
|
|
6
7
|
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 { CB, isPromise, Nullable } from 'vest-utils';\nimport { Isolate, TIsolate, IsolateSelectors } from 'vestjs-runtime';\n\nimport { TestFn, TestFnPayload } from 'TestTypes';\
|
|
1
|
+
{"version":3,"file":"debounce.development.js","sources":["../../src/exports/debounce.ts"],"sourcesContent":["import { registerReconciler } from 'vest';\nimport { CB, isPromise, Nullable } from 'vest-utils';\nimport { Isolate, TIsolate, IsolateSelectors } from 'vestjs-runtime';\n\nimport { TestFn, TestFnPayload } from 'TestTypes';\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,IAAI,GAAG,GAAG,KAAK,CAAC;YAChB,IAAI;AACF,gBAAA,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;AACzB,aAAA;AAAC,YAAA,OAAO,CAAC,EAAE;AACV,gBAAA,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AAClB,aAAA;YAED,IAAI,GAAG,KAAK,KAAK,EAAE;gBACjB,OAAO,MAAM,EAAE,CAAC;AACjB,aAAA;YAED,OAAOA,mBAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;SAClE,EAAE,KAAK,CAAC,CAAC;AACZ,KAAC,CAAC,CAAC;IAEL,MAAM,CAAC,GAAGC,qBAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE;QACvC,YAAY,EAAE,MAAK;AACjB,YAAA,IAAI,OAAO,EAAE;gBACX,YAAY,CAAC,OAAO,CAAC,CAAC;AACvB,aAAA;SACF;AACF,KAAA,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC,MAAM,CAAC;AAClB,CAAC;MAEY,yBAAyB,CAAA;AACpC,IAAA,OAAO,KAAK,CAAC,WAAqB,EAAE,WAAqB,EAAA;QACvD,QACEC,8BAAgB,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC;YACxDA,8BAAgB,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,EACxD;KACH;AAED,IAAA,OAAO,SAAS,CAAC,OAAyB,EAAE,OAAyB,EAAA;;QACnE,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,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
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vest"),t=require("vest-utils"),r=require("vestjs-runtime");const l="Debounce";class o{static match(e,t){return r.IsolateSelectors.isIsolateType(e,l)&&r.IsolateSelectors.isIsolateType(t,l)}static reconcile(e,t){var r,l;return null===(l=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.clearTimeout)||void 0===l||l.call(r),e}}e.registerReconciler(o),exports.IsolateDebounceReconciler=o,exports.default=function(e,o=0){let s=null;return r.Isolate.create(l,(()=>r=>new Promise(((l,i)=>{s=setTimeout((()=>{let o=!1;try{o=e(r)}catch(e){return i(e)}return!1===o?i():t.isPromise(o)?o.then(l,i):l(o)}),o)}))),{clearTimeout:()=>{s&&clearTimeout(s)}}).output};
|
|
2
2
|
//# sourceMappingURL=debounce.production.js.map
|
|
@@ -1 +1 @@
|
|
|
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';\
|
|
1
|
+
{"version":3,"file":"debounce.production.js","sources":["../../src/exports/debounce.ts"],"sourcesContent":["import { registerReconciler } from 'vest';\nimport { CB, isPromise, Nullable } from 'vest-utils';\nimport { Isolate, TIsolate, IsolateSelectors } from 'vestjs-runtime';\n\nimport { TestFn, TestFnPayload } from 'TestTypes';\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":["isolateType","IsolateDebounceReconciler","match","currentNode","historyNode","IsolateSelectors","isIsolateType","reconcile","current","history","_b","_a","data","clearTimeout","call","registerReconciler","callback","delay","timeout","Isolate","create","payload","Promise","resolve","reject","setTimeout","res","e","isPromise","then","output"],"mappings":"8IAMA,MAAMA,EAAc,iBAqCPC,EACX,YAAOC,CAAMC,EAAuBC,GAClC,OACEC,mBAAiBC,cAAcH,EAAaH,IAC5CK,EAAAA,iBAAiBC,cAAcF,EAAaJ,EAE/C,CAED,gBAAOO,CAAUC,EAA2BC,WAG1C,OAF2B,QAA3BC,EAAa,QAAbC,EAAAF,aAAO,EAAPA,EAASG,YAAI,IAAAD,OAAA,EAAAA,EAAEE,oBAAY,IAAAH,GAAAA,EAAAI,KAAAH,GAEpBH,CACR,EASHO,EAAkBA,mBAACd,uDAxDK,SACtBe,EACAC,EAAgB,GAEhB,IAAIC,EAAoC,KA4BxC,OARUC,EAAOA,QAACC,OAAOpB,GAlBf,IAAOqB,GACf,IAAIC,SAAQ,CAACC,EAASC,KACpBN,EAAUO,YAAW,KACnB,IAAIC,GAAM,EACV,IACEA,EAAMV,EAASK,EAChB,CAAC,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 { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\
|
|
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 { suiteSelectors } from 'vest';\nimport { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\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,6DAA6F,CAAA;AAC7F,IAAA,YAAA,CAAA,kCAAA,CAAA,GAAA,qCAAwE,CAAA;AACxE,IAAA,YAAA,CAAA,kCAAA,CAAA,GAAA,0FAA2H,CAAA;AAC3H,IAAA,YAAA,CAAA,iCAAA,CAAA,GAAA,0ZAKyI,CAAA;AACzI,IAAA,YAAA,CAAA,oCAAA,CAAA,GAAA,8KAGoB,CAAA;AACpB,IAAA,YAAA,CAAA,2BAAA,CAAA,GAAA,uIAC+B,CAAA;AAC/B,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,gDAA+D,CAAA;AACjE,CAAC,EAvBW,YAAY,KAAZ,YAAY,GAuBvB,EAAA,CAAA,CAAA;;ACjBK,SAAU,KAAK,CACnB,OAA2B,EAAA;AAE3B,IAAAA,mBAAS,CACP,OAAO,IAAIC,wBAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EAC3C,YAAY,CAAC,2BAA2B,CACzC,CAAC;AAEF,IAAA,MAAM,GAAG,GAAGC,mBAAc,CAAC,OAAO,CAAC,CAAC;IAEpC,MAAM,aAAa,GAA4B,EAAE,CAAC;AAElD,IAAA,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,GAAG,CAAC,SAAS;QACtB,OAAO,EAAE,GAAG,CAAC,SAAS;AACtB,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,GAAG,CAAC,OAAO;QAClB,OAAO,EAAE,GAAG,CAAC,WAAW;KACzB,CAAC;AAEF,IAAA,OAAO,SAAS,CAAC;;IAGjB,SAAS,QAAQ,CAAC,SAAa,EAAA;AAC7B,QAAA,IAAIC,mBAAS,CAAC,SAAS,CAAC,EAAE;AACxB,YAAA,OAAOC,oBAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACtC,SAAA;AAED,QAAA,IAAIH,wBAAc,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE;AAC5C,YAAA,OAAO,aAAa,CAAC,SAAS,CAAC,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
|
|
1
|
+
"use strict";var e,t=require("vest"),s=require("vest-utils");!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){s.invariant(n&&s.hasOwnProperty(n,"valid"),e.PARSER_EXPECT_RESULT_OBJECT);const i=t.suiteSelectors(n),r={},o={invalid:i.hasErrors,pending:i.isPending,tested:function(e){if(s.isNullish(e))return s.isPositive(n.testCount);if(s.hasOwnProperty(r,e))return r[e];return a(e),o.tested(e)},untested:function(e){return!(s.isPositive(n.testCount)&&o.tested(e))},valid:i.isValid,warning:i.hasWarnings};return o;function a(e){r[e]=s.hasOwnProperty(n.tests,e)&&s.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 { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\
|
|
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 { suiteSelectors } from 'vest';\nimport { hasOwnProperty, invariant, isNullish, isPositive } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport { SuiteSummary, TFieldName, TGroupName } from 'SuiteResultTypes';\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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promisify.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/promisify.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 { invariant, isFunction } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport {\n SuiteResult,\n SuiteRunResult,\n TFieldName,\n TGroupName,\n} from 'SuiteResultTypes';\n\nfunction promisify<F extends TFieldName, G extends TGroupName>(\n validatorFn: (...args: any[]) => SuiteRunResult<F, G
|
|
1
|
+
{"version":3,"file":"promisify.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/promisify.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 { invariant, isFunction } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport {\n SuiteResult,\n SuiteRunResult,\n TFieldName,\n TGroupName,\n} from 'SuiteResultTypes';\n\nfunction promisify<F extends TFieldName, G extends TGroupName>(\n validatorFn: (...args: any[]) => SuiteRunResult<F, G>,\n) {\n return (...args: any[]): Promise<SuiteResult<F, G>> => {\n invariant(isFunction(validatorFn), ErrorStrings.PROMISIFY_REQUIRE_FUNCTION);\n\n return new Promise(resolve => validatorFn(...args).done(resolve));\n };\n}\n\nexport default promisify;\n"],"names":["invariant","isFunction"],"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,6DAA6F,CAAA;AAC7F,IAAA,YAAA,CAAA,kCAAA,CAAA,GAAA,qCAAwE,CAAA;AACxE,IAAA,YAAA,CAAA,kCAAA,CAAA,GAAA,0FAA2H,CAAA;AAC3H,IAAA,YAAA,CAAA,iCAAA,CAAA,GAAA,0ZAKyI,CAAA;AACzI,IAAA,YAAA,CAAA,oCAAA,CAAA,GAAA,8KAGoB,CAAA;AACpB,IAAA,YAAA,CAAA,2BAAA,CAAA,GAAA,uIAC+B,CAAA;AAC/B,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,gDAA+D,CAAA;AACjE,CAAC,EAvBW,YAAY,KAAZ,YAAY,GAuBvB,EAAA,CAAA,CAAA;;ACbD,SAAS,SAAS,CAChB,WAAqD,EAAA;AAErD,IAAA,OAAO,CAAC,GAAG,IAAW,KAAgC;QACpDA,mBAAS,CAACC,oBAAU,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,0BAA0B,CAAC,CAAC;AAE5E,QAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAI,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACpE,KAAC,CAAC;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promisify.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/promisify.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 { invariant, isFunction } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport {\n SuiteResult,\n SuiteRunResult,\n TFieldName,\n TGroupName,\n} from 'SuiteResultTypes';\n\nfunction promisify<F extends TFieldName, G extends TGroupName>(\n validatorFn: (...args: any[]) => SuiteRunResult<F, G
|
|
1
|
+
{"version":3,"file":"promisify.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/exports/promisify.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 { invariant, isFunction } from 'vest-utils';\n\nimport { ErrorStrings } from 'ErrorStrings';\nimport {\n SuiteResult,\n SuiteRunResult,\n TFieldName,\n TGroupName,\n} from 'SuiteResultTypes';\n\nfunction promisify<F extends TFieldName, G extends TGroupName>(\n validatorFn: (...args: any[]) => SuiteRunResult<F, G>,\n) {\n return (...args: any[]): Promise<SuiteResult<F, G>> => {\n invariant(isFunction(validatorFn), ErrorStrings.PROMISIFY_REQUIRE_FUNCTION);\n\n return new Promise(resolve => validatorFn(...args).done(resolve));\n };\n}\n\nexport default promisify;\n"],"names":["ErrorStrings","validatorFn","args","invariant","isFunction","PROMISIFY_REQUIRE_FUNCTION","Promise","resolve","done"],"mappings":"iBAAYA,2BAAZ,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,mBCbD,SACEC,GAEA,MAAO,IAAIC,KACTC,EAAAA,UAAUC,EAAAA,WAAWH,GAAcD,EAAaK,4BAEzC,IAAIC,SAAQC,GAAWN,KAAeC,GAAMM,KAAKD,KAE5D"}
|
|
@@ -464,6 +464,27 @@ function hasFocus(focus, fieldName) {
|
|
|
464
464
|
(fieldName ? (_b = (_a = focus === null || focus === void 0 ? void 0 : focus.data.match) === null || _a === void 0 ? void 0 : _a.includes(fieldName)) !== null && _b !== void 0 ? _b : true : true));
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
+
var _a, _b;
|
|
468
|
+
class SummaryBase {
|
|
469
|
+
constructor() {
|
|
470
|
+
this.errorCount = 0;
|
|
471
|
+
this.warnCount = 0;
|
|
472
|
+
this.testCount = 0;
|
|
473
|
+
this.pendingCount = 0;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
class SuiteSummary extends SummaryBase {
|
|
477
|
+
constructor() {
|
|
478
|
+
super(...arguments);
|
|
479
|
+
this[_a] = [];
|
|
480
|
+
this[_b] = [];
|
|
481
|
+
this.groups = {};
|
|
482
|
+
this.tests = {};
|
|
483
|
+
this.valid = null;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
_a = Severity.ERRORS, _b = Severity.WARNINGS;
|
|
487
|
+
|
|
467
488
|
const suiteResultCache = vestUtils.cache();
|
|
468
489
|
const preAggCache = vestUtils.cache();
|
|
469
490
|
function useCreateVestState({ suiteName, VestReconciler, }) {
|
|
@@ -700,27 +721,6 @@ function getFailure(severity, summary, fieldName) {
|
|
|
700
721
|
return (_a = summaryKey.find((summaryFailure) => matchingFieldName(summaryFailure, fieldName))) === null || _a === void 0 ? void 0 : _a.message;
|
|
701
722
|
}
|
|
702
723
|
|
|
703
|
-
var _a, _b;
|
|
704
|
-
class SummaryBase {
|
|
705
|
-
constructor() {
|
|
706
|
-
this.errorCount = 0;
|
|
707
|
-
this.warnCount = 0;
|
|
708
|
-
this.testCount = 0;
|
|
709
|
-
this.pendingCount = 0;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
class SuiteSummary extends SummaryBase {
|
|
713
|
-
constructor() {
|
|
714
|
-
super(...arguments);
|
|
715
|
-
this[_a] = [];
|
|
716
|
-
this[_b] = [];
|
|
717
|
-
this.groups = {};
|
|
718
|
-
this.tests = {};
|
|
719
|
-
this.valid = null;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
_a = Severity.ERRORS, _b = Severity.WARNINGS;
|
|
723
|
-
|
|
724
724
|
class SummaryFailure {
|
|
725
725
|
constructor(fieldName, message, groupName) {
|
|
726
726
|
this.fieldName = fieldName;
|
|
@@ -1095,9 +1095,24 @@ function useCreateSuiteResult() {
|
|
|
1095
1095
|
const summary = useProduceSuiteSummary();
|
|
1096
1096
|
// @vx-allow use-use
|
|
1097
1097
|
const suiteName = useSuiteName();
|
|
1098
|
-
return
|
|
1099
|
-
|
|
1100
|
-
|
|
1098
|
+
return Object.freeze(constructSuiteResultObject(summary, suiteName));
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
function constructSuiteResultObject(summary, suiteName) {
|
|
1102
|
+
return vestUtils.assign(summary, suiteSelectors(summary), {
|
|
1103
|
+
suiteName,
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// @vx-allow use-use
|
|
1108
|
+
function LazyDraft() {
|
|
1109
|
+
const emptySummary = constructSuiteResultObject(new SuiteSummary());
|
|
1110
|
+
return new Proxy(emptySummary, {
|
|
1111
|
+
get: (_, prop) => {
|
|
1112
|
+
// @vx-allow use-use
|
|
1113
|
+
const result = useCreateSuiteResult();
|
|
1114
|
+
return result[prop];
|
|
1115
|
+
},
|
|
1101
1116
|
});
|
|
1102
1117
|
}
|
|
1103
1118
|
|
|
@@ -1119,7 +1134,7 @@ function skipWhen(condition, callback) {
|
|
|
1119
1134
|
// we should skip the test if the parent conditional is true.
|
|
1120
1135
|
useIsExcludedIndividually() ||
|
|
1121
1136
|
// Otherwise, we should skip the test if the conditional is true.
|
|
1122
|
-
vestUtils.optionalFunctionValue(condition,
|
|
1137
|
+
vestUtils.optionalFunctionValue(condition, LazyDraft()),
|
|
1123
1138
|
}, callback);
|
|
1124
1139
|
});
|
|
1125
1140
|
}
|
|
@@ -1230,7 +1245,7 @@ function omitWhen(conditional, callback) {
|
|
|
1230
1245
|
vestjsRuntime.Isolate.create(VestIsolateType.OmitWhen, () => {
|
|
1231
1246
|
SuiteContext.run({
|
|
1232
1247
|
omitted: useWithinActiveOmitWhen() ||
|
|
1233
|
-
vestUtils.optionalFunctionValue(conditional,
|
|
1248
|
+
vestUtils.optionalFunctionValue(conditional, LazyDraft()),
|
|
1234
1249
|
}, callback);
|
|
1235
1250
|
});
|
|
1236
1251
|
}
|