vest 5.0.0-dev-9c596e → 5.0.0-dev-ae6b14

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.
Files changed (47) hide show
  1. package/dist/cjs/classnames.development.js +1 -2
  2. package/dist/cjs/classnames.production.js +1 -1
  3. package/dist/cjs/enforce/compose.development.js +1 -5
  4. package/dist/cjs/enforce/compose.production.js +1 -1
  5. package/dist/cjs/enforce/compounds.development.js +3 -6
  6. package/dist/cjs/enforce/compounds.production.js +1 -1
  7. package/dist/cjs/enforce/schema.development.js +3 -6
  8. package/dist/cjs/enforce/schema.production.js +1 -1
  9. package/dist/cjs/parser.development.js +1 -4
  10. package/dist/cjs/parser.production.js +1 -1
  11. package/dist/cjs/promisify.development.js +1 -2
  12. package/dist/cjs/promisify.production.js +1 -1
  13. package/dist/cjs/vest.development.js +516 -682
  14. package/dist/cjs/vest.production.js +1 -1
  15. package/dist/es/classnames.development.js +1 -2
  16. package/dist/es/classnames.production.js +1 -1
  17. package/dist/es/parser.development.js +1 -2
  18. package/dist/es/parser.production.js +1 -1
  19. package/dist/es/promisify.development.js +1 -2
  20. package/dist/es/promisify.production.js +1 -1
  21. package/dist/es/vest.development.js +512 -676
  22. package/dist/es/vest.production.js +1 -1
  23. package/dist/umd/classnames.development.js +1 -2
  24. package/dist/umd/classnames.production.js +1 -1
  25. package/dist/umd/enforce/compose.development.js +1 -7
  26. package/dist/umd/enforce/compose.production.js +1 -1
  27. package/dist/umd/enforce/compounds.development.js +3 -6
  28. package/dist/umd/enforce/compounds.production.js +1 -1
  29. package/dist/umd/enforce/schema.development.js +3 -6
  30. package/dist/umd/enforce/schema.production.js +1 -1
  31. package/dist/umd/parser.development.js +1 -4
  32. package/dist/umd/parser.production.js +1 -1
  33. package/dist/umd/promisify.development.js +1 -2
  34. package/dist/umd/promisify.production.js +1 -1
  35. package/dist/umd/vest.development.js +520 -687
  36. package/dist/umd/vest.production.js +1 -1
  37. package/package.json +137 -136
  38. package/testUtils/TVestMock.ts +1 -1
  39. package/testUtils/asVestTest.ts +9 -0
  40. package/types/classnames.d.ts +82 -4
  41. package/types/classnames.d.ts.map +1 -1
  42. package/types/parser.d.ts +82 -4
  43. package/types/parser.d.ts.map +1 -1
  44. package/types/promisify.d.ts +82 -4
  45. package/types/promisify.d.ts.map +1 -1
  46. package/types/vest.d.ts +152 -140
  47. package/types/vest.d.ts.map +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,n,s,i,r=require("n4s"),o=require("vest-utils"),u=require("context");function a(t,e,n){if(o.isNullish(t.children))return;let s=!1;for(const r of t.children){if(s)return;if((o.isNullish(n)||o.optionalFunctionValue(n,r))&&e(r,i),s)return;a(r,((t,n)=>{e(t,(()=>{n(),i()}))}),n)}function i(){s=!0}}function c(t,e,n){let s=!1;return a(t,((t,n)=>{e(t)&&(n(),s=!0)}),n),s}function l(t,e){let n=t;for(;n.parent;){if(e(n))return n;n=n.parent}return null}!function(t){t[t.Immediate=0]="Immediate",t[t.Delayed=1]="Delayed"}(t||(t={})),function(t){t.HOOK_CALLED_OUTSIDE="hook called outside of a running suite.",t.EXPECTED_VEST_TEST="Expected value to be an instance of IsolateTest",t.FIELD_NAME_REQUIRED="Field name must be passed",t.SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION="Suite must be initialized with a function",t.NO_ACTIVE_ISOLATE="Not within an active isolate",t.PROMISIFY_REQUIRE_FUNCTION="Vest.Promisify must be called with a function",t.PARSER_EXPECT_RESULT_OBJECT="Vest parser: expected argument at position 0 to be Vest's result object.",t.WARN_MUST_BE_CALLED_FROM_TEST="Warn must be called from within the body of a test function",t.EACH_CALLBACK_MUST_BE_A_FUNCTION="Each must be called with a function",t.INVALID_PARAM_PASSED_TO_FUNCTION='Incompatible params passed to {fn_name} function. "{param}" must be of type {expected}',t.ENCOUNTERED_THE_SAME_KEY_TWICE='Encountered the same test key "{key}" twice. This may lead to tests overriding each other\'s results, or to tests being unexpectedly omitted.',t.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.',t.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||(e={})),function(t){t.TEST_RUN_STARTED="test_run_started",t.TEST_COMPLETED="test_completed",t.ALL_RUNNING_TESTS_FINISHED="all_running_tests_finished",t.REMOVE_FIELD="remove_field",t.RESET_FIELD="reset_field",t.RESET_SUITE="reset_suite",t.SUITE_RUN_STARTED="suite_run_started"}(n||(n={}));class d{static reconciler(t,e){return o.isNullish(e),t}static reconcile(t,e){var n;const s=Ot(),i=At();let r=i;s&&(r=null!==(n=null==i?void 0:i.at(Ct()))&&void 0!==n?n:null);const u=this.reconciler(t,r);return o.invariant(u),Object.is(u,t)?[t,E(r,t,e)]:[u,u.output]}static removeAllNextNodesInIsolate(){const t=Ot(),e=At();e&&t&&e.slice(Ct())}static handleCollision(t,e){return t.usesKey()?this.handleIsolateNodeWithKey(t):(this.nodeReorderDetected(t,e)&&this.onNodeReorder(t,e),e||t)}static nodeReorderDetected(t,e){return!(null!=t?t:e)}static onNodeReorder(t,e){return this.removeAllNextNodesInIsolate(),null!=t?t:e}static handleIsolateNodeWithKey(t){o.invariant(t.usesKey());const n=function(t){var e;if(o.isNullish(t))return null;const n=St().historyNode;return null!==(e=null==n?void 0:n.keys[t])&&void 0!==e?e:null}(t.key);let s=t;return o.isNullish(n)||(s=n),function(t,n){if(!t)return;const s=Ot();if(o.invariant(s,e.NO_ACTIVE_ISOLATE),o.isNullish(s.keys[t]))return void(s.keys[t]=n);o.deferThrow(o.text(e.ENCOUNTERED_THE_SAME_KEY_TWICE,{key:t}))}(t.key,t),s}}function E(t,e,n){const s=yt(),i=ht.run(Object.assign({historyNode:t,runtimeNode:e},!s&&{runtimeRoot:e}),(()=>n(e)));return e.output=i,i}class f{constructor(t){this.children=[],this.keys={},this.parent=null,this.key=null,this.allowReorder=!1}setParent(t){return this.parent=t,this}saveOutput(t){return this.output=t,this}setKey(t){return this.key=t,this}usesKey(){return o.isNotNullish(this.key)}addChild(t){o.invariant(this.children),this.children.push(t)}removeChild(t){var e,n;this.children=null!==(n=null===(e=this.children)||void 0===e?void 0:e.filter((e=>e!==t)))&&void 0!==n?n:null}slice(t){o.isNullish(this.children)||(this.children.length=t)}at(t){var e,n;return null!==(n=null===(e=this.children)||void 0===e?void 0:e[t])&&void 0!==n?n:null}cursor(){var t,e;return null!==(e=null===(t=this.children)||void 0===t?void 0:t.length)&&void 0!==e?e:0}shouldAllowReorder(){var t;return null!==(t=!!l(this,(t=>t.allowReorder)))&&void 0!==t&&t}get rootNode(){var t;return null!==(t=l(this,(t=>o.isNullish(t.parent))))&&void 0!==t?t:this}static create(t,e){return this.createImplementation(t,e)}static createImplementation(t,e){const n=Ot(),s=new this(e).setParent(n),[i,r]=this.reconciler.reconcile(s,t);return i.saveOutput(r),this.setNode(i),i}static setNode(t){const n=Ot();n?function(t){const n=Ot();o.invariant(n,e.NO_ACTIVE_ISOLATE),n.addChild(t)}(t):function(t){const e=ht.useX(),[,n]=e.historyRoot();n(t)}(t),t.setParent(n)}static is(t){return t instanceof f}}function N(t,e){return!!e&&!h(t,e)}function h(t,e){return!(!e||t.fieldName!==e)}function T(t,e){return h(t,e.fieldName)&&t.groupName===e.groupName&&t.key===e.key}function R(t){return t===s.ERRORS?i.ERROR_COUNT:i.WARN_COUNT}f.reconciler=d,function(t){t.WARNINGS="warnings",t.ERRORS="errors"}(s||(s={})),function(t){t.ERROR_COUNT="errorCount",t.WARN_COUNT="warnCount"}(i||(i={}));const S=o.bindNot((function(t,e){return t.groupName===e}));function p(t){return function(t,e){return Et.someTests((n=>I(n,t,e)))}(s.ERRORS,t)}function I(t,e,n){return!!t.hasFailures()&&(!N(t,n)&&!function(t,e){return o.either(t===s.WARNINGS,e.warns())}(e,t))}var _;function v(){return function(t){const[e]=D();return e===t}(exports.Modes.EAGER)}exports.Modes=void 0,(_=exports.Modes||(exports.Modes={})).ALL="ALL",_.EAGER="EAGER";const m=u.createCascade(((t,e)=>e?null:o.assign({exclusion:{tests:{},groups:{}},inclusion:{},mode:o.tinyState.createTinyState(exports.Modes.EAGER),testMemoCache:O},t)));function g(t){return m.useX(t).exclusion}function A(){return m.useX().inclusion}function D(){return m.useX().mode()}const O=o.cache(10);var C,y,P,F;class U{constructor(){this.errorCount=0,this.warnCount=0,this.testCount=0}}class L extends U{constructor(){super(...arguments),this[C]=[],this[y]=[],this.groups={},this.tests={},this.valid=!1}}function W(t){return!!Ut(t)||!Et.hasNoTests()&&(!p(t)&&(!function(t){return Et.someIncompleteTests((e=>x(e,t)))}(t)&&function(t){return Et.everyTest((e=>k(e,t)))}(t)))}function G(t,e){return!!Ut(e)||!function(t,e,n){return Et.someTests((s=>!S(s,e)&&I(s,t,n)))}(s.ERRORS,t,e)&&(!function(t,e){return Et.someIncompleteTests((n=>!S(n,t)&&x(n,e)))}(t,e)&&function(t,e){return Et.everyTest((n=>!!S(n,t)||k(n,e)))}(t,e))}function x(t,e){return!N(t,e)&&Ut(e)}function k(e,n){return!!N(e,n)||(function(e){var n;return(null===(n=Pt())||void 0===n?void 0:n.getOptionalField(e.fieldName).type)===t.Delayed&&e.awaitsResolution()}(e)||e.isTested()||e.isOmitted())}function w(){const t=new L;return Et.walkTests((e=>{t.tests=function(t,e){const{fieldName:n}=e,s=Object.assign({},t);return s[n]=b(s[n],e),s[n].valid=!1!==s[n].valid&&W(n),s}(t.tests,e),t.groups=function(t,e){const{groupName:n,fieldName:s}=e;if(!n)return t;const i=Object.assign({},t);return i[n]=i[n]||{},i[n][s]=b(i[n][s],e),i[n][s].valid=!1!==i[n][s].valid&&G(n,s),i}(t.groups,e),t.errors=M(s.ERRORS,t.errors,e),t.warnings=M(s.WARNINGS,t.warnings,e)})),t.valid=W(),function(t){for(const e in t.tests)t.errorCount+=t.tests[e].errorCount,t.warnCount+=t.tests[e].warnCount,t.testCount+=t.tests[e].testCount;return t}(t)}function M(t,e,n){return(t===s.WARNINGS?n.isWarning():n.isFailing())?e.concat({fieldName:n.fieldName,groupName:n.groupName,message:n.message}):e}function b(t,e){const{message:n}=e,i=o.defaultTo(t?Object.assign({},t):null,V);return e.isNonActionable()||(i.testCount++,e.isFailing()?r(s.ERRORS):e.isWarning()&&r(s.WARNINGS)),i;function r(t){const e=R(t);i[e]++,n&&(i[t]=(i[t]||[]).concat(n))}}function V(){return o.assign(new U,{errors:[],warnings:[],valid:!0})}function K(t,e,n){return n?function(t,e,n){var s;return(null===(s=null==t?void 0:t[n])||void 0===s?void 0:s[e])||[]}(t,e,n):function(t,e){const n={},s=R(e);for(const i in t)o.isPositive(t[i][s])&&(n[i]=t[i][e]||[]);return n}(t,e)}function B(t){const e={getError:function(e){return J(s.ERRORS,t,e)},getErrors:function(e){return X(t,s.ERRORS,e)},getErrorsByGroup:function(e,n){return j(t,s.ERRORS,e,n)},getWarning:function(e){return J(s.WARNINGS,t,e)},getWarnings:function(e){return X(t,s.WARNINGS,e)},getWarningsByGroup:function(e,n){return j(t,s.WARNINGS,e,n)},hasErrors:function(e){return Y(t,i.ERROR_COUNT,e)},hasErrorsByGroup:function(e,n){return H(t,i.ERROR_COUNT,e,n)},hasWarnings:function(e){return Y(t,i.WARN_COUNT,e)},hasWarningsByGroup:function(e,n){return H(t,i.WARN_COUNT,e,n)},isValid:function(e){var n;return e?Boolean(null===(n=t.tests[e])||void 0===n?void 0:n.valid):t.valid},isValidByGroup:function(e,n){const s=t.groups[e];if(!s)return!1;if(n)return q(s,n);for(const t in s)if(!q(s,t))return!1;return!0}};return e}function X(t,e,n){return K(t.tests,e,n)}function j(t,e,n,s){return K(t.groups[n],e,s)}function q(t,e){var n;return!!(null===(n=t[e])||void 0===n?void 0:n.valid)}function H(t,e,n,s){var i,r;const u=t.groups[n];if(!u)return!1;if(s)return o.isPositive(null===(i=u[s])||void 0===i?void 0:i[e]);for(const t in u)if(o.isPositive(null===(r=u[t])||void 0===r?void 0:r[e]))return!0;return!1}function Y(t,e,n){var s;const i=n?null===(s=t.tests[n])||void 0===s?void 0:s[e]:t[e]||0;return o.isPositive(i)}function J(t,e,n){var s;const i=e[t];return n?null===(s=i.find((t=>h(t,n))))||void 0===s?void 0:s.message:i[0]}function Q(){const t=w(),e=St().suiteName;return function(t){const e=St().suiteResultCache;return e([Dt()],t)}((()=>o.assign(t,B(t),{suiteName:e})))}function Z(t,e){f.create((()=>{m.run({skipped:z()||o.optionalFunctionValue(t,o.optionalFunctionValue(Q))},e)}))}function z(){return function(){var t;return null!==(t=m.useX().skipped)&&void 0!==t&&t}()}function $(t){return nt(0,"tests",t)}function tt(t){return nt(1,"tests",t)}function et(t){const{fieldName:e,groupName:n}=t;if(z())return!0;const s=g(),i=A(),r=s.tests,u=r[e];if(!1===u)return!0;const a=!0===u;if(n){if(function(t){const e=g(),n=e.groups,s=o.hasOwnProperty(n,t);if(s)return!1===n[t];return it()}(n))return!0;if(!0===s.groups[n])return!a&&(!!st(r)||!1===r[e])}return!!function(t){if(!it())return!1;return!t}(n)||!a&&(!!st(r)&&!o.optionalFunctionValue(i[e]))}function nt(t,n,s){const i=g(e.HOOK_CALLED_OUTSIDE);s&&o.asArray(s).forEach((e=>{o.isStringValue(e)&&(i[n][e]=0===t)}))}function st(t){for(const e in t)if(!0===t[e])return!0;return!1}function it(){const t=g();for(const e in t.groups)if(t.groups[e])return!0;return!1}function rt(t,e){f.create((()=>{m.run({omitted:ot()||o.optionalFunctionValue(t,o.optionalFunctionValue(Q))},e)}))}function ot(){return function(){var t;return null!==(t=m.useX().omitted)&&void 0!==t&&t}()}function ut(t,e=t){return function(t){return v()&&p(t.fieldName)}(t)?((n=t).skip(),n):function(t){return ot()||Ut(t.fieldName)}(t)?function(t){return t.omit(),t}(t):et(t)?function(t){return t.skip(z()),t}(e):t;var n}C=s.ERRORS,y=s.WARNINGS,$.group=function(t){return nt(0,"groups",t)},tt.group=function(t){return nt(1,"groups",t)};function at(){return function(t){let e=t.initial;return{getState:function(){return e},transition:function(n,s){let i=t.states[e][n];if(Array.isArray(i)){const[,t]=i;if(!t(s))return;i=i[0]}i&&i!==e&&(e=i)}}}(ct)}!function(t){t.UNTESTED="UNTESTED",t.SKIPPED="SKIPPED",t.FAILED="FAILED",t.WARNING="WARNING",t.PASSING="PASSING",t.PENDING="PENDING",t.CANCELED="CANCELED",t.OMITTED="OMITTED"}(P||(P={})),function(t){t.RESET="RESET"}(F||(F={}));const ct={initial:P.UNTESTED,states:{[P.UNTESTED]:{[P.CANCELED]:P.CANCELED,[P.FAILED]:P.FAILED,[P.OMITTED]:P.OMITTED,[P.PASSING]:P.PASSING,[P.PENDING]:P.PENDING,[P.SKIPPED]:P.SKIPPED,[P.WARNING]:P.WARNING},[P.SKIPPED]:{[F.RESET]:P.UNTESTED},[P.FAILED]:{[F.RESET]:P.UNTESTED},[P.WARNING]:{[F.RESET]:P.UNTESTED},[P.PASSING]:{[F.RESET]:P.UNTESTED},[P.PENDING]:{[F.RESET]:P.UNTESTED,[P.CANCELED]:P.CANCELED,[P.FAILED]:P.FAILED,[P.OMITTED]:P.OMITTED,[P.PASSING]:P.PASSING,[P.SKIPPED]:[P.SKIPPED,t=>!0===t],[P.WARNING]:P.WARNING},[P.CANCELED]:{[F.RESET]:P.UNTESTED},[P.OMITTED]:{[F.RESET]:P.UNTESTED}}};class lt extends f{constructor({fieldName:t,testFn:e,message:n,groupName:s,key:i=null}){super(),this.children=null,this.id=o.seq(),this.severity=dt.Error,this.stateMachine=at(),this.fieldName=t,this.testFn=e,s&&(this.groupName=s),n&&(this.message=n),this.setKey(i)}static create(t,e){return lt.cast(super.create(t,e))}static cast(t){return lt.isX(t),t}get status(){return this.stateMachine.getState()}setStatus(t,e){this.stateMachine.transition(t,e)}run(){let t;try{t=this.testFn()}catch(e){(function(t,e){return o.isUndefined(t)&&o.isStringValue(e)})(this.message,e)&&(this.message=e),t=!1}return!1===t&&this.fail(),t}warns(){return this.severity===dt.Warning}isPending(){return this.statusEquals(P.PENDING)}isOmitted(){return this.statusEquals(P.OMITTED)}isUntested(){return this.statusEquals(P.UNTESTED)}isFailing(){return this.statusEquals(P.FAILED)}isCanceled(){return this.statusEquals(P.CANCELED)}isSkipped(){return this.statusEquals(P.SKIPPED)}isPassing(){return this.statusEquals(P.PASSING)}isWarning(){return this.statusEquals(P.WARNING)}hasFailures(){return this.isFailing()||this.isWarning()}isNonActionable(){return this.isSkipped()||this.isOmitted()||this.isCanceled()}isTested(){return this.hasFailures()||this.isPassing()}awaitsResolution(){return this.isSkipped()||this.isUntested()||this.isPending()}statusEquals(t){return this.status===t}setPending(){this.setStatus(P.PENDING)}fail(){this.setStatus(this.warns()?P.WARNING:P.FAILED)}pass(){this.setStatus(P.PASSING)}warn(){this.severity=dt.Warning}skip(t){this.setStatus(P.SKIPPED,t)}cancel(){this.setStatus(P.CANCELED)}reset(){this.stateMachine.transition(F.RESET)}omit(){this.setStatus(P.OMITTED)}valueOf(){return!this.isFailing()}isAsyncTest(){return o.isPromise(this.asyncTest)}static is(t){return t instanceof lt}static isX(t){o.invariant(this.is(t))}}var dt;lt.reconciler=class extends d{static reconciler(t,e){if(!lt.is(t))return t;if(o.isNullish(e))return this.handleNoHistoryNode(t);if(!lt.is(e))return t;const n=this.pickNode(e,t);return function(t,e,n){t===e&&lt.is(e)&&(i=e)!==(s=n)&&T(s,i)&&s.isPending()&&s.cancel();var s,i}(n,t,e),n}static nodeReorderDetected(t,e){return!!lt.is(e)&&!T(e,t)}static handleCollision(t,e){return t.usesKey()?lt.cast(this.handleIsolateNodeWithKey(t)):this.nodeReorderDetected(t,e)?this.onNodeReorder(t,e):lt.cast(e||t)}static onNodeReorder(t,n){return function(t,n){if(t.shouldAllowReorder())return;o.deferThrow(o.text(e.TESTS_CALLED_IN_DIFFERENT_ORDER,{fieldName:t.fieldName,prevName:lt.is(n)?n.fieldName:void 0}))}(t,n),this.removeAllNextNodesInIsolate(),t}static pickNode(t,e){return ut(e,this.handleCollision(e,t))}static handleNoHistoryNode(t){return t.usesKey()?lt.cast(this.handleIsolateNodeWithKey(t)):t}},function(t){t.Error="error",t.Warning="warning"}(dt||(dt={}));class Et{static defaultRoot(){return Pt()}static hasNoTests(t=Et.defaultRoot()){return!t||(e=t,n=lt.is,!c(e,(()=>!0),n));var e,n}static someIncompleteTests(t,e=Et.defaultRoot()){return!!e&&c(e,(e=>(lt.isX(e),e.isPending()&&t(e))),lt.is)}static someTests(t,e=Et.defaultRoot()){return!!e&&c(e,(e=>(lt.isX(e),t(e))),lt.is)}static everyTest(t,e=Et.defaultRoot()){return!!e&&function(t,e,n){let s=!0;return a(t,((t,n)=>{e(t)||(n(),s=!1)}),n),s}(e,(e=>(lt.isX(e),t(e))),lt.is)}static walkTests(t,e=Et.defaultRoot()){e&&a(e,((e,n)=>{t(lt.cast(e),n)}),lt.is)}static hasRemainingTests(t){return Et.someIncompleteTests((e=>!t||h(e,t)))}static pluckTests(t,e=Et.defaultRoot()){e&&function(t,e,n){a(t,(t=>{e(t)&&t.parent&&t.parent.removeChild(t)}),n)}(e,(e=>(lt.isX(e),t(e))),lt.is)}static resetField(t){Et.walkTests((e=>{h(e,t)&&e.reset()}),Et.defaultRoot())}static removeTestByFieldName(t,e=Et.defaultRoot()){Et.pluckTests((e=>h(e,t)),e)}}function ft(){const t=o.bus.createBus();return e(n.TEST_COMPLETED,(e=>{e.isCanceled()||(!function(t){const[e]=mt();t&&!Et.hasRemainingTests(t)&&o.isArray(e[t])&&o.callEach(e[t])}(e.fieldName),Et.hasRemainingTests()||t.emit(n.ALL_RUNNING_TESTS_FINISHED))})),e(n.TEST_RUN_STARTED,(()=>{})),e(n.ALL_RUNNING_TESTS_FINISHED,(()=>{!function(){const[t]=vt();o.callEach(t)}()})),e(n.RESET_FIELD,(t=>{Et.resetField(t)})),e(n.SUITE_RUN_STARTED,(()=>{Rt()})),e(n.REMOVE_FIELD,(t=>{Et.removeTestByFieldName(t)})),e(n.RESET_SUITE,(()=>{!function(){Rt();const[,,t]=gt();t()}()})),t;function e(e,n){t.on(e,((...t)=>{!function(){const t=St().suiteResultCache;t.invalidate([Dt()])}(),n(...t)}))}}const Nt=o.cache(),ht=u.createCascade(((t,e)=>{if(e)return null;o.invariant(t.historyRoot);const[n]=t.historyRoot(),s={};return o.assign(s,{historyNode:n,runtimeNode:null,runtimeRoot:null},t),s}));function Tt(t){const e=ht.useX();return function(...n){var s;const i=null!==(s=ht.use())&&void 0!==s?s:e;return ht.run(i,(()=>t(...n)))}}function Rt(){const[,,t]=vt(),[,,e]=mt();t(),e()}function St(){return ht.useX()}function pt(){return St().VestBus}function It(){return Tt(pt().emit)}function _t(t){const e=It();return n=>e(t,n)}function vt(){return St().doneCallbacks()}function mt(){return St().fieldCallbacks()}function gt(){return St().historyRoot()}function At(){return St().historyNode}function Dt(){return St().suiteId}function Ot(){var t;return null!==(t=St().runtimeNode)&&void 0!==t?t:null}function Ct(){var t,e;return null!==(e=null===(t=Ot())||void 0===t?void 0:t.cursor())&&void 0!==e?e:0}function yt(){return St().runtimeRoot}function Pt(){const t=yt();if(t)return t;const[e]=gt();return e}function Ft(e){const n=yt();if(o.isArray(e)||o.isStringValue(e))o.asArray(e).forEach((e=>{n.setOptionalField(e,(()=>({type:t.Delayed,applied:!1,rule:null})))}));else for(const s in e){const i=e[s];n.setOptionalField(s,(()=>({type:t.Immediate,rule:i,applied:o.optionalFunctionValue(i)})))}}function Ut(t){var e,n,s;return!!t&&(null!==(s=null===(n=null===(e=Pt())||void 0===e?void 0:e.getOptionalField(t))||void 0===n?void 0:n.applied)&&void 0!==s&&s)}class Lt extends f{constructor(){super(...arguments),this.optional={}}setOptionalField(t,e){const n=this.optional,s=n[t];Object.assign(n,{[t]:Object.assign({},s,e(s))})}getOptionalField(t){var e;return null!==(e=this.optional[t])&&void 0!==e?e:{}}}function Wt(t){const e=A(),n=g();return o.invariant(o.isStringValue(t)),e[t]=o.defaultTo(n.tests[t],!0),{when:function(e){const n=A(),s=g();n[t]=()=>o.hasOwnProperty(s.tests,t)?o.defaultTo(s.tests[t],!0):o.isStringValue(e)?Boolean(s.tests[e]):o.optionalFunctionValue(e,o.optionalFunctionValue(Q))}}}function Gt(t){ut(t),t.isNonActionable()||(t.isUntested()?function(t){const n=pt(),s=function(t){return m.run({currentTest:t},(()=>t.run()))}(t);try{o.isPromise(s)?(t.asyncTest=s,t.setPending(),xt(t)):kt(n,t)}catch(n){throw new Error(o.text(e.UNEXPECTED_TEST_REGISTRATION_ERROR,{testObject:JSON.stringify(t),error:n}))}}(t):t.isAsyncTest()&&(t.setPending(),xt(t)))}function xt(t){const{asyncTest:e,message:n}=t;if(!o.isPromise(e))return;const s=pt(),i=Tt((()=>{kt(s,t)})),r=Tt((e=>{t.isCanceled()||(t.message=o.isStringValue(e)?e:n,t.fail(),i())}));e.then(i,r)}function kt(t,e){e.pass(),t.emit(n.TEST_COMPLETED,e)}function wt(t,...s){const[i,r,u]=o.isFunction(s[1])?s:[void 0,...s];!function(t,n){const s="test";o.invariant(o.isStringValue(t),o.text(e.INVALID_PARAM_PASSED_TO_FUNCTION,{fn_name:s,param:"fieldName",expected:"string"})),o.invariant(o.isFunction(n),o.text(e.INVALID_PARAM_PASSED_TO_FUNCTION,{fn_name:s,param:"callback",expected:"function"}))}(t,r);const a={fieldName:t,groupName:m.useX().groupName,key:u,message:i,testFn:r};return It()(n.TEST_RUN_STARTED),lt.create(Gt,a)}const Mt=o.assign(wt,{memo:function(t){return function(e,...n){const[s,i,r]=n.reverse();return function(t,e){const n=m.useX().testMemoCache,s=n.get(t);if(o.isNull(s))return n(t,e);const[,i]=s;if(i.isCanceled())return n.invalidate(t),n(t,e);return lt.setNode(i),i}([Dt(),e,Ct()].concat(s),(function(){return t(e,r,i)}))}}(wt)});function bt(){return{group:jt,include:Wt,omitWhen:rt,only:$,optional:Ft,skip:tt,skipWhen:Z,test:Mt}}function Vt(){return o.assign({},Q(),{done:Tt(Kt)})}function Kt(...t){const[e,n]=t.reverse(),s=Vt();if(function(t,e,n){var s;return!!(!o.isFunction(t)||e&&o.numberEquals(null===(s=n.tests[e])||void 0===s?void 0:s.testCount,0))}(e,n,s))return s;const i=()=>e(Q());return Et.hasRemainingTests(n)?(function(t,e){const[,n]=mt(),[,s]=vt();e?n((n=>o.assign(n,{[e]:(n[e]||[]).concat(t)}))):s((e=>e.concat(t)))}(i,n),s):(i(),s)}function Bt(...t){const[s,i]=t.reverse();!function(t){o.invariant(o.isFunction(t),e.SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION)}(s);const r=function({suiteName:t}={}){return{VestBus:ft(),doneCallbacks:o.tinyState.createTinyState((()=>[])),fieldCallbacks:o.tinyState.createTinyState((()=>({}))),historyRoot:o.tinyState.createTinyState(null),suiteId:o.seq(),suiteName:t,suiteResultCache:Nt}}({suiteName:i});function u(...t){return m.run({},(()=>(It()(n.SUITE_RUN_STARTED),Lt.create(function(t,...e){return()=>(t(...e),Vt())}(s,...t))))).output}return ht.run(r,(()=>o.assign(ht.bind(r,u),Object.assign({get:Tt(Q),remove:_t(n.REMOVE_FIELD),reset:_t(n.RESET_SUITE),resetField:_t(n.RESET_FIELD)},bt()))))}class Xt extends f{constructor(){super(...arguments),this.allowReorder=!0}}function jt(t,e){return f.create((()=>{m.run({groupName:t},e)}))}const qt=e.WARN_MUST_BE_CALLED_FROM_TEST;Object.defineProperty(exports,"enforce",{enumerable:!0,get:function(){return r.enforce}}),exports.create=Bt,exports.each=function(t,n){o.invariant(o.isFunction(n),e.EACH_CALLBACK_MUST_BE_A_FUNCTION),Xt.create((()=>{t.forEach(((t,e)=>{n(t,e)}))}))},exports.group=jt,exports.include=Wt,exports.mode=function(t){const[,e]=D();e(t)},exports.omitWhen=rt,exports.only=$,exports.optional=Ft,exports.skip=tt,exports.skipWhen=Z,exports.staticSuite=function(t){return o.assign(((...e)=>Bt(t)(...e)),Object.assign({},bt()))},exports.suiteSelectors=B,exports.test=Mt,exports.warn=function(){const t=(n=e.HOOK_CALLED_OUTSIDE,m.useX(n).currentTest);var n;o.invariant(t,qt),t.warn()};
1
+ "use strict";var t,e,n,s=require("n4s"),i=require("vest-utils"),r=require("vestjs-runtime"),o=require("context");function u(e){const n=r.VestRuntime.useAvailableRoot();if(i.isArray(e)||i.isStringValue(e))i.asArray(e).forEach((e=>{n.setOptionalField(e,(()=>({type:t.AUTO,applied:!1,rule:null})))}));else for(const s in e){const i=e[s];n.setOptionalField(s,(()=>({type:t.CUSTOM_LOGIC,rule:i,applied:!0===i})))}}function a(t){var e,n,s;return!!t&&(null!==(s=null===(n=null===(e=r.VestRuntime.useAvailableRoot())||void 0===e?void 0:e.getOptionalField(t))||void 0===n?void 0:n.applied)&&void 0!==s&&s)}!function(t){t[t.CUSTOM_LOGIC=0]="CUSTOM_LOGIC",t[t.AUTO=1]="AUTO"}(t||(t={})),exports.Modes=void 0,(e=exports.Modes||(exports.Modes={})).EAGER="EAGER",e.ALL="ALL",e.ONE="ONE",function(t){t.TEST_RUN_STARTED="test_run_started",t.TEST_COMPLETED="test_completed",t.ALL_RUNNING_TESTS_FINISHED="all_running_tests_finished",t.REMOVE_FIELD="remove_field",t.RESET_FIELD="reset_field",t.RESET_SUITE="reset_suite",t.SUITE_RUN_STARTED="suite_run_started",t.SUITE_CALLBACK_RUN_FINISHED="SUITE_CALLBACK_RUN_FINISHED",t.DONE_TEST_OMISSION_PASS="DONE_TEST_OMISSION_PASS"}(n||(n={}));class c extends r.Isolate{constructor(){super(...arguments),this.optional={}}setOptionalField(t,e){const n=this.optional,s=n[t];Object.assign(n,{[t]:Object.assign({},s,e(s))})}getOptionalField(t){var e;return null!==(e=this.optional[t])&&void 0!==e?e:{}}getOptionalFields(){return this.optional}}const l=i.cache();function E(){return r.VestRuntime.useXAppData()}function f(){return E().doneCallbacks()}function N(){return E().fieldCallbacks()}function d(){return E().suiteId}function T(){const[,,t]=f(),[,,e]=N();t(),e()}const R=o.createCascade(((t,e)=>e?null:i.assign({exclusion:{tests:{},groups:{}},inclusion:{},mode:i.tinyState.createTinyState(exports.Modes.EAGER),testMemoCache:m},t)));function S(t){return R.useX(t).exclusion}function p(){return R.useX().inclusion}function I(){return R.useX().mode()}const m=i.cache(10);var _,g,h,O,A,v;function D(t,e){return!!e&&!C(t,e)}function C(t,e){return!(!e||t.fieldName!==e)}function P(t,e){return C(t,e.fieldName)&&t.groupName===e.groupName&&t.key===e.key}function F(t){return t===g.ERRORS?h.ERROR_COUNT:h.WARN_COUNT}!function(t){t.HOOK_CALLED_OUTSIDE="hook called outside of a running suite.",t.EXPECTED_VEST_TEST="Expected value to be an instance of IsolateTest",t.FIELD_NAME_REQUIRED="Field name must be passed",t.SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION="Suite must be initialized with a function",t.PROMISIFY_REQUIRE_FUNCTION="Vest.Promisify must be called with a function",t.PARSER_EXPECT_RESULT_OBJECT="Vest parser: expected argument at position 0 to be Vest's result object.",t.WARN_MUST_BE_CALLED_FROM_TEST="Warn must be called from within the body of a test function",t.EACH_CALLBACK_MUST_BE_A_FUNCTION="Each must be called with a function",t.INVALID_PARAM_PASSED_TO_FUNCTION='Incompatible params passed to {fn_name} function. "{param}" must be of type {expected}',t.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.',t.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}.",t.UNEXPECTED_TEST_RUN_ERROR="Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}."}(_||(_={})),function(t){t.WARNINGS="warnings",t.ERRORS="errors"}(g||(g={})),function(t){t.ERROR_COUNT="errorCount",t.WARN_COUNT="warnCount"}(h||(h={})),function(t){t.Error="error",t.Warning="warning"}(O||(O={}));class U{constructor(){this.errorCount=0,this.warnCount=0,this.testCount=0}}class L extends U{constructor(){super(...arguments),this[A]=[],this[v]=[],this.groups={},this.tests={},this.valid=!1}}A=g.ERRORS,v=g.WARNINGS;class y{constructor(t,e,n){this.fieldName=t,this.message=e,this.groupName=n}static fromTestObject(t){return new y(t.fieldName,t.message,t.groupName)}toString(){return this.message||""}}const G=i.bindNot((function(t,e){return t.groupName===e}));function W(t){return function(t,e){return Rt.someTests((n=>V(n,t,e)))}(g.ERRORS,t)}function V(t,e,n){return!!t.hasFailures()&&(!D(t,n)&&!function(t,e){return i.either(t===g.WARNINGS,e.warns())}(e,t))}function b(t){return!!a(t)||!Rt.hasNoTests()&&(!W(t)&&(!function(t){return Rt.someIncompleteTests((e=>!D(e,t)&&!a(t)))}(t)&&function(t){return Rt.everyTest((e=>x(e,t)))}(t)))}function M(t,e){return!!a(e)||!function(t,e,n){return Rt.someTests((s=>!G(s,e)&&V(s,t,n)))}(g.ERRORS,t,e)&&(!function(t,e){return Rt.someIncompleteTests((n=>!G(n,t)&&(!D(n,e)&&!a(e))))}(t,e)&&function(t,e){return Rt.everyTest((n=>!!G(n,t)||x(n,e)))}(t,e))}function x(e,n){return!!D(e,n)||(e.isOmitted()||e.isTested()||function(e){var n;return(null===(n=r.VestRuntime.useAvailableRoot())||void 0===n?void 0:n.getOptionalField(e.fieldName).type)===t.AUTO&&e.awaitsResolution()}(e))}function w(){const t=new L;return Rt.walkTests((e=>{t.tests=function(t,e){const{fieldName:n}=e,s=Object.assign({},t);return s[n]=B(s[n],e),s[n].valid=!1!==s[n].valid&&b(n),s}(t.tests,e),t.groups=function(t,e){const{groupName:n,fieldName:s}=e;if(!n)return t;const i=Object.assign({},t);return i[n]=i[n]||{},i[n][s]=B(i[n][s],e),i[n][s].valid=!1!==i[n][s].valid&&M(n,s),i}(t.groups,e),t.errors=k(g.ERRORS,t.errors,e),t.warnings=k(g.WARNINGS,t.warnings,e)})),t.valid=b(),function(t){for(const e in t.tests)t.errorCount+=t.tests[e].errorCount,t.warnCount+=t.tests[e].warnCount,t.testCount+=t.tests[e].testCount;return t}(t)}function k(t,e,n){if(n.isOmitted())return e;return(t===g.WARNINGS?n.isWarning():n.isFailing())?e.concat(y.fromTestObject(n)):e}function B(t,e){const{message:n}=e,s=i.defaultTo(t?Object.assign({},t):null,j);return e.isNonActionable()||(s.testCount++,e.isFailing()?r(g.ERRORS):e.isWarning()&&r(g.WARNINGS)),s;function r(t){const e=F(t);s[e]++,n&&(s[t]=(s[t]||[]).concat(n))}}function j(){return i.assign(new U,{errors:[],warnings:[],valid:!0})}function K(t,e,n){return n?function(t,e,n){var s;return(null===(s=null==t?void 0:t[n])||void 0===s?void 0:s[e])||[]}(t,e,n):function(t,e){const n={},s=F(e);for(const r in t)i.isPositive(t[r][s])&&(n[r]=t[r][e]||[]);return n}(t,e)}function X(t){const e={getError:function(e){return Q(g.ERRORS,t,e)},getErrors:function(e){return q(t,g.ERRORS,e)},getErrorsByGroup:function(e,n){return H(t,g.ERRORS,e,n)},getWarning:function(e){return Q(g.WARNINGS,t,e)},getWarnings:function(e){return q(t,g.WARNINGS,e)},getWarningsByGroup:function(e,n){return H(t,g.WARNINGS,e,n)},hasErrors:function(e){return Y(t,h.ERROR_COUNT,e)},hasErrorsByGroup:function(e,n){return J(t,h.ERROR_COUNT,e,n)},hasWarnings:function(e){return Y(t,h.WARN_COUNT,e)},hasWarningsByGroup:function(e,n){return J(t,h.WARN_COUNT,e,n)},isValid:function(e){var n;return e?Boolean(null===(n=t.tests[e])||void 0===n?void 0:n.valid):t.valid},isValidByGroup:function(e,n){const s=t.groups[e];if(!s)return!1;if(n)return z(s,n);for(const t in s)if(!z(s,t))return!1;return!0}};return e}function q(t,e,n){return K(t.tests,e,n)}function H(t,e,n,s){return K(t.groups[n],e,s)}function z(t,e){var n;return!!(null===(n=t[e])||void 0===n?void 0:n.valid)}function J(t,e,n,s){var r,o;const u=t.groups[n];if(!u)return!1;if(s)return i.isPositive(null===(r=u[s])||void 0===r?void 0:r[e]);for(const t in u)if(i.isPositive(null===(o=u[t])||void 0===o?void 0:o[e]))return!0;return!1}function Y(t,e,n){var s;const r=n?null===(s=t.tests[n])||void 0===s?void 0:s[e]:t[e]||0;return i.isPositive(r)}function Q(t,e,n){var s;const i=e[t];return n?null===(s=i.find((t=>C(t,n))))||void 0===s?void 0:s.message:i[0]}function Z(){return t=()=>{const t=w(),e=E().suiteName;return Object.freeze(i.assign(t,X(t),{suiteName:e}))},(0,E().suiteResultCache)([d()],t);var t}function $(t,e){r.Isolate.create((()=>{R.run({skipped:tt()||i.optionalFunctionValue(t,i.optionalFunctionValue(Z))},e)}))}function tt(){return function(){var t;return null!==(t=R.useX().skipped)&&void 0!==t&&t}()}function et(t){return it(0,"tests",t)}function nt(t){return it(1,"tests",t)}function st(t){const{fieldName:e,groupName:n}=t;if(tt())return!0;const s=S(),r=p(),o=s.tests,u=o[e];if(!1===u)return!0;const a=!0===u;if(n){if(function(t){const e=S().groups;if(i.hasOwnProperty(e,t))return!1===e[t];return ot()}(n))return!0;if(!0===s.groups[n])return!a&&(!!rt(o)||!1===o[e])}return!!function(t){if(!ot())return!1;return!t}(n)||!a&&(!!rt(o)&&!i.optionalFunctionValue(r[e]))}function it(t,e,n){const s=S(_.HOOK_CALLED_OUTSIDE);n&&i.asArray(n).forEach((n=>{i.isStringValue(n)&&(s[e][n]=0===t)}))}function rt(t){for(const e in t)if(!0===t[e])return!0;return!1}function ot(){const t=S();for(const e in t.groups)if(t.groups[e])return!0;return!1}function ut(t){const[e]=I();return e===t}function at(t){return ut(exports.Modes.ONE)?W():!!ut(exports.Modes.EAGER)&&W(t.fieldName)}function ct(t,e){r.Isolate.create((()=>{R.run({omitted:lt()||i.optionalFunctionValue(t,i.optionalFunctionValue(Z))},e)}))}function lt(){return function(){var t;return null!==(t=R.useX().omitted)&&void 0!==t&&t}()}function Et(t,e=t){return at(t)?((n=t).skip(),n):function(t){return lt()||a(t.fieldName)}(t)?function(t){return t.omit(),t}(t):st(t)?function(t){return t.skip(tt()),t}(e):t;var n}var ft,Nt;et.group=function(t){return it(0,"groups",t)},nt.group=function(t){return it(1,"groups",t)},function(t){t.UNTESTED="UNTESTED",t.SKIPPED="SKIPPED",t.FAILED="FAILED",t.WARNING="WARNING",t.PASSING="PASSING",t.PENDING="PENDING",t.CANCELED="CANCELED",t.OMITTED="OMITTED"}(ft||(ft={})),function(t){t.RESET="RESET"}(Nt||(Nt={}));const dt={initial:ft.UNTESTED,states:{"*":{[ft.OMITTED]:ft.OMITTED,[Nt.RESET]:ft.UNTESTED},[ft.UNTESTED]:{[ft.CANCELED]:ft.CANCELED,[ft.FAILED]:ft.FAILED,[ft.PASSING]:ft.PASSING,[ft.PENDING]:ft.PENDING,[ft.SKIPPED]:ft.SKIPPED,[ft.WARNING]:ft.WARNING},[ft.PENDING]:{[ft.CANCELED]:ft.CANCELED,[ft.FAILED]:ft.FAILED,[ft.PASSING]:ft.PASSING,[ft.SKIPPED]:[ft.SKIPPED,t=>!0===t],[ft.WARNING]:ft.WARNING},[ft.SKIPPED]:{},[ft.FAILED]:{},[ft.WARNING]:{},[ft.PASSING]:{},[ft.CANCELED]:{},[ft.OMITTED]:{}}};class Tt extends r.Isolate{constructor({fieldName:t,testFn:e,message:n,groupName:s,key:r=null}){super(),this.children=null,this.id=i.seq(),this.severity=O.Error,this.stateMachine=i.StateMachine(dt),this.fieldName=t,this.testFn=e,s&&(this.groupName=s),n&&(this.message=n),this.setKey(r)}static create(t,e){return Tt.cast(super.create(t,e))}static cast(t){return Tt.isX(t),t}get status(){return this.stateMachine.getState()}setStatus(t,e){this.stateMachine.transition(t,e)}run(){let t;try{t=this.testFn()}catch(e){(function(t,e){return i.isUndefined(t)&&i.isStringValue(e)})(this.message,e)&&(this.message=e),t=!1}return!1===t&&this.fail(),t}warns(){return this.severity===O.Warning}isPending(){return this.statusEquals(ft.PENDING)}isOmitted(){return this.statusEquals(ft.OMITTED)}isUntested(){return this.statusEquals(ft.UNTESTED)}isFailing(){return this.statusEquals(ft.FAILED)}isCanceled(){return this.statusEquals(ft.CANCELED)}isSkipped(){return this.statusEquals(ft.SKIPPED)}isPassing(){return this.statusEquals(ft.PASSING)}isWarning(){return this.statusEquals(ft.WARNING)}hasFailures(){return this.isFailing()||this.isWarning()}isNonActionable(){return this.isSkipped()||this.isOmitted()||this.isCanceled()}isTested(){return this.hasFailures()||this.isPassing()}awaitsResolution(){return this.isSkipped()||this.isUntested()||this.isPending()}statusEquals(t){return this.status===t}setPending(){this.setStatus(ft.PENDING)}fail(){this.setStatus(this.warns()?ft.WARNING:ft.FAILED)}pass(){this.setStatus(ft.PASSING)}warn(){this.severity=O.Warning}skip(t){this.setStatus(ft.SKIPPED,t)}cancel(){this.setStatus(ft.CANCELED)}reset(){this.stateMachine.transition(Nt.RESET)}omit(){this.setStatus(ft.OMITTED)}valueOf(){return!this.isFailing()}isAsyncTest(){return i.isPromise(this.asyncTest)}static is(t){return t instanceof Tt}static isX(t){i.invariant(this.is(t))}}Tt.reconciler=function(t,e){if(!Tt.is(t))return t;if(i.isNullish(e))return function(t){if(t.usesKey())return Tt.cast(r.Reconciler.handleIsolateNodeWithKey(t));return t}(t);if(!Tt.is(e))return t;const n=function(t,e){const n=function(t,e){if(t.usesKey())return Tt.cast(r.Reconciler.handleIsolateNodeWithKey(t));if(function(t,e){return!!Tt.is(e)&&!P(e,t)}(t,e))return function(t,e){return function(t,e){if(t.shouldAllowReorder())return;i.deferThrow(i.text(_.TESTS_CALLED_IN_DIFFERENT_ORDER,{fieldName:t.fieldName,prevName:Tt.is(e)?e.fieldName:void 0}))}(t,e),r.Reconciler.removeAllNextNodesInIsolate(),t}(t,e);if(!Tt.is(e))return t;if(e.isOmitted())return t;return e}(e,t);return Et(e,n)}(e,t);return function(t,e,n){t===e&&Tt.is(e)&&(i=e)!==(s=n)&&P(s,i)&&s.isPending()&&s.cancel();var s,i}(n,t,e),n};class Rt{static defaultRoot(){return r.VestRuntime.useAvailableRoot()}static hasNoTests(t=Rt.defaultRoot()){return!t||!r.Walker.has(t,Tt.is)}static someIncompleteTests(t,e=Rt.defaultRoot()){return!!e&&r.Walker.some(e,(e=>(Tt.isX(e),e.isPending()&&t(e))),Tt.is)}static someTests(t,e=Rt.defaultRoot()){return!!e&&r.Walker.some(e,(e=>(Tt.isX(e),t(e))),Tt.is)}static everyTest(t,e=Rt.defaultRoot()){return!!e&&r.Walker.every(e,(e=>(Tt.isX(e),t(e))),Tt.is)}static walkTests(t,e=Rt.defaultRoot()){e&&r.Walker.walk(e,((e,n)=>{t(Tt.cast(e),n)}),Tt.is)}static hasRemainingTests(t){return Rt.someIncompleteTests((e=>!t||C(e,t)))}static pluckTests(t,e=Rt.defaultRoot()){e&&r.Walker.pluck(e,(e=>(Tt.isX(e),t(e))),Tt.is)}static resetField(t){Rt.walkTests((e=>{C(e,t)&&e.reset()}),Rt.defaultRoot())}static removeTestByFieldName(t,e=Rt.defaultRoot()){Rt.pluckTests((e=>C(e,t)),e)}}function St(){const t=r.VestRuntime.useAvailableRoot(),e=r.VestRuntime.useEmit(),s=null==t?void 0:t.getOptionalFields();if(i.isEmpty(s))return;const o=new Set;function u(e){o.has(e.fieldName)&&(e.omit(),null==t||t.setOptionalField(e.fieldName,(t=>Object.assign(Object.assign({},t),{applied:!0}))))}Rt.walkTests((e=>{e.isPending()||(i.hasOwnProperty(o,e.fieldName)?u(e):function(e){const n=null==t?void 0:t.getOptionalField(e.fieldName);if(i.isNullish(n))return;!0===i.optionalFunctionValue(n.rule)&&o.add(e.fieldName);u(e)}(e))})),e(n.DONE_TEST_OMISSION_PASS)}function pt(){const t=r.VestRuntime.useBus();return e(n.TEST_COMPLETED,(e=>{e.isCanceled()||(!function(t){const[e]=N();t&&!Rt.hasRemainingTests(t)&&i.isArray(e[t])&&i.callEach(e[t])}(e.fieldName),Rt.hasRemainingTests()||t.emit(n.ALL_RUNNING_TESTS_FINISHED))})),e(n.TEST_RUN_STARTED,(()=>{})),e(n.DONE_TEST_OMISSION_PASS,(()=>{})),e(n.ALL_RUNNING_TESTS_FINISHED,(()=>{Rt.someTests((t=>t.isAsyncTest()))&&St(),function(){const[t]=f();i.callEach(t)}()})),e(n.RESET_FIELD,(t=>{Rt.resetField(t)})),e(n.SUITE_RUN_STARTED,(()=>{T()})),e(n.SUITE_CALLBACK_RUN_FINISHED,(()=>{St()})),e(n.REMOVE_FIELD,(t=>{Rt.removeTestByFieldName(t)})),e(n.RESET_SUITE,(()=>{T(),r.VestRuntime.reset()})),t;function e(e,n){t.on(e,((...t)=>{E().suiteResultCache.invalidate([d()]),n(...t)}))}}function It(t,e){return r.Isolate.create((()=>{R.run({groupName:t},e)}))}function mt(t){const e=p(),n=S();return i.invariant(i.isStringValue(t)),e[t]=i.defaultTo(n.tests[t],!0),{when:function(e){const n=p(),s=S();n[t]=()=>i.hasOwnProperty(s.tests,t)?i.defaultTo(s.tests[t],!0):i.isStringValue(e)?Boolean(s.tests[e]):i.optionalFunctionValue(e,i.optionalFunctionValue(Z))}}}function _t(t){if(Et(t),t.isUntested())return function(t){const e=r.VestRuntime.useBus(),n=function(t){return R.run({currentTest:t},(()=>t.run()))}(t);try{i.isPromise(n)?(t.asyncTest=n,function(t){const{asyncTest:e,message:n}=t;if(!i.isPromise(e))return;t.setPending();const s=r.VestRuntime.useBus(),o=r.VestRuntime.persist((()=>{gt(s,t)})),u=r.VestRuntime.persist((e=>{t.isCanceled()||(t.message=i.isStringValue(e)?e:n,t.fail(),o())}));e.then(o,u)}(t)):gt(e,t)}catch(e){throw new Error(i.text(_.UNEXPECTED_TEST_REGISTRATION_ERROR,{testObject:JSON.stringify(t),error:e}))}}(t);t.isNonActionable()||i.deferThrow(i.text(_.UNEXPECTED_TEST_REGISTRATION_ERROR,{testObject:JSON.stringify(t)}))}function gt(t,e){e.pass(),t.emit(n.TEST_COMPLETED,e)}function ht(t,...e){const[s,o,u]=i.isFunction(e[1])?e:[void 0,...e];!function(t,e){const n="test";i.invariant(i.isStringValue(t),i.text(_.INVALID_PARAM_PASSED_TO_FUNCTION,{fn_name:n,param:"fieldName",expected:"string"})),i.invariant(i.isFunction(e),i.text(_.INVALID_PARAM_PASSED_TO_FUNCTION,{fn_name:n,param:"callback",expected:"function"}))}(t,o);const a={fieldName:t,groupName:R.useX().groupName,key:u,message:s,testFn:o};return r.VestRuntime.useEmit()(n.TEST_RUN_STARTED),Tt.create(_t,a)}const Ot=i.assign(ht,{memo:function(t){return function(e,...n){const[s,o,u]=n.reverse();return function(t,e){const n=R.useX().testMemoCache,s=n.get(t);if(i.isNull(s))return n(t,e);const[,r]=s;if(r.isCanceled())return n.invalidate(t),n(t,e);return Tt.setNode(r),r}([d(),e,r.VestRuntime.useCurrentCursor()].concat(s),(function(){return t(e,u,o)}))}}(ht)});function At(){return{group:It,include:mt,omitWhen:ct,only:et,optional:u,skip:nt,skipWhen:$,test:Ot}}function vt(){return Object.freeze(i.assign({done:r.VestRuntime.persist(Dt)},Z()))}function Dt(...t){const[e,n]=t.reverse(),s=vt();if(function(t,e,n){var s;return!!(!i.isFunction(t)||e&&i.numberEquals(null===(s=n.tests[e])||void 0===s?void 0:s.testCount,0))}(e,n,s))return s;const r=()=>e(Z());return Rt.hasRemainingTests(n)?(function(t,e){const[,n]=N(),[,s]=f();e?n((n=>i.assign(n,{[e]:(n[e]||[]).concat(t)}))):s((e=>e.concat(t)))}(r,n),s):(r(),s)}function Ct(...t){const[e,s]=t.reverse();!function(t){i.invariant(i.isFunction(t),_.SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION)}(e);const o=function({suiteName:t}={}){const e={doneCallbacks:i.tinyState.createTinyState((()=>[])),fieldCallbacks:i.tinyState.createTinyState((()=>({}))),suiteId:i.seq(),suiteName:t,suiteResultCache:l};return r.VestRuntime.createRef(e)}({suiteName:s});function u(...t){return R.run({},(()=>(r.VestRuntime.useEmit()(n.SUITE_RUN_STARTED),c.create(function(t,...e){const s=r.VestRuntime.useEmit();return()=>(t(...e),s(n.SUITE_CALLBACK_RUN_FINISHED),vt())}(e,...t))))).output}return r.VestRuntime.Run(o,(()=>{return pt(),i.assign(r.VestRuntime.persist(u),Object.assign(Object.assign({get:r.VestRuntime.persist(Z),remove:r.VestRuntime.usePrepareEmitter(n.REMOVE_FIELD),reset:r.VestRuntime.usePrepareEmitter(n.RESET_SUITE),resetField:r.VestRuntime.usePrepareEmitter(n.RESET_FIELD)},(t=r.VestRuntime.persist(Z),{getError:(...e)=>t().getError(...e),getErrors:(...e)=>t().getErrors(...e),getErrorsByGroup:(...e)=>t().getErrorsByGroup(...e),getWarning:(...e)=>t().getWarning(...e),getWarnings:(...e)=>t().getWarnings(...e),getWarningsByGroup:(...e)=>t().getWarningsByGroup(...e),hasErrors:(...e)=>t().hasErrors(...e),hasErrorsByGroup:(...e)=>t().hasErrorsByGroup(...e),hasWarnings:(...e)=>t().hasWarnings(...e),hasWarningsByGroup:(...e)=>t().hasWarningsByGroup(...e),isValid:(...e)=>t().isValid(...e),isValidByGroup:(...e)=>t().isValidByGroup(...e)})),At()));var t}))}class Pt extends r.Isolate{constructor(){super(...arguments),this.allowReorder=!0}}const Ft=_.WARN_MUST_BE_CALLED_FROM_TEST;Object.defineProperty(exports,"enforce",{enumerable:!0,get:function(){return s.enforce}}),exports.create=Ct,exports.each=function(t,e){i.invariant(i.isFunction(e),_.EACH_CALLBACK_MUST_BE_A_FUNCTION),Pt.create((()=>{t.forEach(((t,n)=>{e(t,n)}))}))},exports.group=It,exports.include=mt,exports.mode=function(t){const[,e]=I();e(t)},exports.omitWhen=ct,exports.only=et,exports.optional=u,exports.skip=nt,exports.skipWhen=$,exports.staticSuite=function(t){return i.assign(((...e)=>Ct(t)(...e)),Object.assign({},At()))},exports.suiteSelectors=X,exports.test=Ot,exports.warn=function(){const t=(e=_.HOOK_CALLED_OUTSIDE,R.useX(e).currentTest);var e;i.invariant(t,Ft),t.warn()};
@@ -7,15 +7,14 @@ var ErrorStrings;
7
7
  ErrorStrings["EXPECTED_VEST_TEST"] = "Expected value to be an instance of IsolateTest";
8
8
  ErrorStrings["FIELD_NAME_REQUIRED"] = "Field name must be passed";
9
9
  ErrorStrings["SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION"] = "Suite must be initialized with a function";
10
- ErrorStrings["NO_ACTIVE_ISOLATE"] = "Not within an active isolate";
11
10
  ErrorStrings["PROMISIFY_REQUIRE_FUNCTION"] = "Vest.Promisify must be called with a function";
12
11
  ErrorStrings["PARSER_EXPECT_RESULT_OBJECT"] = "Vest parser: expected argument at position 0 to be Vest's result object.";
13
12
  ErrorStrings["WARN_MUST_BE_CALLED_FROM_TEST"] = "Warn must be called from within the body of a test function";
14
13
  ErrorStrings["EACH_CALLBACK_MUST_BE_A_FUNCTION"] = "Each must be called with a function";
15
14
  ErrorStrings["INVALID_PARAM_PASSED_TO_FUNCTION"] = "Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}";
16
- ErrorStrings["ENCOUNTERED_THE_SAME_KEY_TWICE"] = "Encountered the same test key \"{key}\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.";
17
15
  ErrorStrings["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.";
18
16
  ErrorStrings["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}.";
17
+ ErrorStrings["UNEXPECTED_TEST_RUN_ERROR"] = "Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.";
19
18
  })(ErrorStrings || (ErrorStrings = {}));
20
19
 
21
20
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1 +1 @@
1
- import{invariant as e,hasOwnProperty as t,isNullish as n,isPositive as s,isFunction as o}from"vest-utils";import{suiteSelectors as i}from"vest";var r;function a(a,E={}){const u=function(o){e(o&&t(o,"valid"),r.PARSER_EXPECT_RESULT_OBJECT);const a=i(o),E={},u={invalid:a.hasErrors,tested:function(e){return n(e)?s(o.testCount):t(E,e)?E[e]:(c(e),u.tested(e))},untested:function(e){return!(s(o.testCount)&&u.tested(e))},valid:a.isValid,warning:a.hasWarnings};return u;function c(e){E[e]=t(o.tests,e)&&s(o.tests[e].testCount)}}(a);return function(e){const t=[];for(const n in E){const s=n;o(u[s])&&u[s](e)&&t.push(E[s])}return t.join(" ")}}!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.NO_ACTIVE_ISOLATE="Not within an active isolate",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.ENCOUNTERED_THE_SAME_KEY_TWICE='Encountered the same test key "{key}" twice. This may lead to tests overriding each other\'s results, or to tests being unexpectedly omitted.',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}."}(r||(r={}));export{a as default};
1
+ import{invariant as e,hasOwnProperty as t,isNullish as n,isPositive as s,isFunction as r}from"vest-utils";import{suiteSelectors as o}from"vest";var i;function a(a,u={}){const E=function(r){e(r&&t(r,"valid"),i.PARSER_EXPECT_RESULT_OBJECT);const a=o(r),u={},E={invalid:a.hasErrors,tested:function(e){return n(e)?s(r.testCount):t(u,e)?u[e]:(c(e),E.tested(e))},untested:function(e){return!(s(r.testCount)&&E.tested(e))},valid:a.isValid,warning:a.hasWarnings};return E;function c(e){u[e]=t(r.tests,e)&&s(r.tests[e].testCount)}}(a);return function(e){const t=[];for(const n in u){const s=n;r(E[s])&&E[s](e)&&t.push(u[s])}return t.join(" ")}}!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}."}(i||(i={}));export{a as default};
@@ -7,15 +7,14 @@ var ErrorStrings;
7
7
  ErrorStrings["EXPECTED_VEST_TEST"] = "Expected value to be an instance of IsolateTest";
8
8
  ErrorStrings["FIELD_NAME_REQUIRED"] = "Field name must be passed";
9
9
  ErrorStrings["SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION"] = "Suite must be initialized with a function";
10
- ErrorStrings["NO_ACTIVE_ISOLATE"] = "Not within an active isolate";
11
10
  ErrorStrings["PROMISIFY_REQUIRE_FUNCTION"] = "Vest.Promisify must be called with a function";
12
11
  ErrorStrings["PARSER_EXPECT_RESULT_OBJECT"] = "Vest parser: expected argument at position 0 to be Vest's result object.";
13
12
  ErrorStrings["WARN_MUST_BE_CALLED_FROM_TEST"] = "Warn must be called from within the body of a test function";
14
13
  ErrorStrings["EACH_CALLBACK_MUST_BE_A_FUNCTION"] = "Each must be called with a function";
15
14
  ErrorStrings["INVALID_PARAM_PASSED_TO_FUNCTION"] = "Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}";
16
- ErrorStrings["ENCOUNTERED_THE_SAME_KEY_TWICE"] = "Encountered the same test key \"{key}\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.";
17
15
  ErrorStrings["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.";
18
16
  ErrorStrings["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}.";
17
+ ErrorStrings["UNEXPECTED_TEST_RUN_ERROR"] = "Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.";
19
18
  })(ErrorStrings || (ErrorStrings = {}));
20
19
 
21
20
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1 +1 @@
1
- import{suiteSelectors as e}from"vest";import{invariant as t,hasOwnProperty as s,isNullish as n,isPositive as i}from"vest-utils";var r;function o(o){t(o&&s(o,"valid"),r.PARSER_EXPECT_RESULT_OBJECT);const a=e(o),E={},u={invalid:a.hasErrors,tested:function(e){if(n(e))return i(o.testCount);if(s(E,e))return E[e];return _(e),u.tested(e)},untested:function(e){return!(i(o.testCount)&&u.tested(e))},valid:a.isValid,warning:a.hasWarnings};return u;function _(e){E[e]=s(o.tests,e)&&i(o.tests[e].testCount)}}!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.NO_ACTIVE_ISOLATE="Not within an active isolate",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.ENCOUNTERED_THE_SAME_KEY_TWICE='Encountered the same test key "{key}" twice. This may lead to tests overriding each other\'s results, or to tests being unexpectedly omitted.',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}."}(r||(r={}));export{o as parse};
1
+ import{suiteSelectors as e}from"vest";import{invariant as t,hasOwnProperty as s,isNullish as n,isPositive as r}from"vest-utils";var i;function o(o){t(o&&s(o,"valid"),i.PARSER_EXPECT_RESULT_OBJECT);const a=e(o),E={},u={invalid:a.hasErrors,tested:function(e){if(n(e))return r(o.testCount);if(s(E,e))return E[e];return _(e),u.tested(e)},untested:function(e){return!(r(o.testCount)&&u.tested(e))},valid:a.isValid,warning:a.hasWarnings};return u;function _(e){E[e]=s(o.tests,e)&&r(o.tests[e].testCount)}}!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}."}(i||(i={}));export{o as parse};
@@ -6,15 +6,14 @@ var ErrorStrings;
6
6
  ErrorStrings["EXPECTED_VEST_TEST"] = "Expected value to be an instance of IsolateTest";
7
7
  ErrorStrings["FIELD_NAME_REQUIRED"] = "Field name must be passed";
8
8
  ErrorStrings["SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION"] = "Suite must be initialized with a function";
9
- ErrorStrings["NO_ACTIVE_ISOLATE"] = "Not within an active isolate";
10
9
  ErrorStrings["PROMISIFY_REQUIRE_FUNCTION"] = "Vest.Promisify must be called with a function";
11
10
  ErrorStrings["PARSER_EXPECT_RESULT_OBJECT"] = "Vest parser: expected argument at position 0 to be Vest's result object.";
12
11
  ErrorStrings["WARN_MUST_BE_CALLED_FROM_TEST"] = "Warn must be called from within the body of a test function";
13
12
  ErrorStrings["EACH_CALLBACK_MUST_BE_A_FUNCTION"] = "Each must be called with a function";
14
13
  ErrorStrings["INVALID_PARAM_PASSED_TO_FUNCTION"] = "Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}";
15
- ErrorStrings["ENCOUNTERED_THE_SAME_KEY_TWICE"] = "Encountered the same test key \"{key}\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.";
16
14
  ErrorStrings["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.";
17
15
  ErrorStrings["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}.";
16
+ ErrorStrings["UNEXPECTED_TEST_RUN_ERROR"] = "Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.";
18
17
  })(ErrorStrings || (ErrorStrings = {}));
19
18
 
20
19
  function promisify(validatorFn) {
@@ -1 +1 @@
1
- import{invariant as e,isFunction as t}from"vest-utils";var s;function n(n){return(...o)=>(e(t(n),s.PROMISIFY_REQUIRE_FUNCTION),new Promise((e=>n(...o).done(e))))}!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.NO_ACTIVE_ISOLATE="Not within an active isolate",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.ENCOUNTERED_THE_SAME_KEY_TWICE='Encountered the same test key "{key}" twice. This may lead to tests overriding each other\'s results, or to tests being unexpectedly omitted.',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}."}(s||(s={}));export{n as default};
1
+ import{invariant as e,isFunction as t}from"vest-utils";var s;function n(n){return(...r)=>(e(t(n),s.PROMISIFY_REQUIRE_FUNCTION),new Promise((e=>n(...r).done(e))))}!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}."}(s||(s={}));export{n as default};