vest 4.5.0 → 4.6.2-dev-fcaa09
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/enforce_compose.development.js +2 -0
- package/dist/cjs/enforce_compose.js +7 -0
- package/dist/cjs/enforce_compose.production.js +1 -0
- package/dist/cjs/enforce_compounds.development.js +4 -0
- package/dist/cjs/enforce_compounds.js +7 -0
- package/dist/cjs/enforce_compounds.production.js +1 -0
- package/dist/cjs/enforce_schema.development.js +4 -0
- package/dist/cjs/enforce_schema.js +7 -0
- package/dist/cjs/enforce_schema.production.js +1 -0
- package/dist/cjs/vest.development.js +149 -168
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/enforce_compose.development.js +1 -0
- package/dist/es/enforce_compose.production.js +1 -0
- package/dist/es/enforce_compounds.development.js +1 -0
- package/dist/es/enforce_compounds.production.js +1 -0
- package/dist/es/enforce_schema.development.js +1 -0
- package/dist/es/enforce_schema.production.js +1 -0
- package/dist/es/vest.development.js +150 -169
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +11 -59
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce_compose.development.js +8 -0
- package/dist/umd/enforce_compose.production.js +1 -0
- package/dist/umd/enforce_compounds.development.js +8 -0
- package/dist/umd/enforce_compounds.production.js +1 -0
- package/dist/umd/enforce_schema.development.js +8 -0
- package/dist/umd/enforce_schema.production.js +1 -0
- package/dist/umd/parser.development.js +10 -58
- package/dist/umd/parser.production.js +1 -1
- package/dist/umd/promisify.development.js +5 -31
- package/dist/umd/promisify.production.js +1 -1
- package/dist/umd/vest.development.js +253 -1066
- package/dist/umd/vest.production.js +1 -1
- package/enforce_compose/package.json +9 -0
- package/enforce_compounds/package.json +9 -0
- package/enforce_schema/package.json +9 -0
- package/package.json +80 -79
- package/tsconfig.json +85 -1
- package/types/classnames.d.ts +1 -0
- package/types/classnames.d.ts.map +1 -0
- package/types/enforce_compose.d.ts +2 -0
- package/types/enforce_compose.d.ts.map +1 -0
- package/types/enforce_compounds.d.ts +2 -0
- package/types/enforce_compounds.d.ts.map +1 -0
- package/types/enforce_schema.d.ts +2 -0
- package/types/enforce_schema.d.ts.map +1 -0
- package/types/parser.d.ts +1 -0
- package/types/parser.d.ts.map +1 -0
- package/types/promisify.d.ts +1 -0
- package/types/promisify.d.ts.map +1 -0
- package/types/vest.d.ts +40 -37
- package/types/vest.d.ts.map +1 -0
- package/dist/cjs/compose.js +0 -7
- package/dist/cjs/compounds.js +0 -7
- package/dist/cjs/enforce/compose.development.js +0 -60
- package/dist/cjs/enforce/compose.production.js +0 -1
- package/dist/cjs/enforce/compounds.development.js +0 -92
- package/dist/cjs/enforce/compounds.production.js +0 -1
- package/dist/cjs/enforce/package.json +0 -1
- package/dist/cjs/enforce/schema.development.js +0 -92
- package/dist/cjs/enforce/schema.production.js +0 -1
- package/dist/cjs/schema.js +0 -7
- package/dist/es/enforce/compose.development.js +0 -58
- package/dist/es/enforce/compose.production.js +0 -1
- package/dist/es/enforce/compounds.development.js +0 -90
- package/dist/es/enforce/compounds.production.js +0 -1
- package/dist/es/enforce/package.json +0 -1
- package/dist/es/enforce/schema.development.js +0 -88
- package/dist/es/enforce/schema.production.js +0 -1
- package/dist/umd/enforce/compose.development.js +0 -736
- package/dist/umd/enforce/compose.production.js +0 -1
- package/dist/umd/enforce/compounds.development.js +0 -762
- package/dist/umd/enforce/compounds.production.js +0 -1
- package/dist/umd/enforce/schema.development.js +0 -768
- package/dist/umd/enforce/schema.production.js +0 -1
- package/enforce/compose/package.json +0 -9
- package/enforce/compounds/package.json +0 -9
- package/enforce/schema/package.json +0 -9
- package/types/enforce/compose.d.ts +0 -126
- package/types/enforce/compounds.d.ts +0 -138
- package/types/enforce/schema.d.ts +0 -143
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).vest={})}(this,(function(n){function t(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return!n.apply(void 0,t)}}function e(n){var t=Number(n);return!(isNaN(parseFloat(String(n)))||isNaN(Number(n))||!isFinite(t))}function r(n,t){return e(n)&&e(t)&&Number(n)===Number(t)}function u(n,t){return r(n.length,t)}function i(n,t){return e(n)&&e(t)&&Number(n)>Number(t)}function o(n,t){return i(n.length,t)}function s(n){function t(n){return e.findIndex((function(t){var e=t[0];return u(n,e.length)&&n.every((function(n,t){return n===e[t]}))}))}void 0===n&&(n=1);var e=[],r=function(t,u){var i=r.get(t);return i?i[1]:(u=u(),e.unshift([t.concat(),u]),o(e,n)&&(e.length=n),u)};return r.invalidate=function(n){-1<(n=t(n))&&e.splice(n,1)},r.get=function(n){return e[t(n)]||null},r}function a(n){return null===n}function c(n){return void 0===n}function f(n){return null===n||c(n)}function l(n){return"function"==typeof n}function p(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return l(n)?n.apply(void 0,t):n}function d(n,t){var e;return null!==(e=p(n))&&void 0!==e?e:p(t)}function v(n){return!!Array.isArray(n)}function h(n){return(n=[].concat(n))[n.length-1]}function N(n,t){for(var e=[],r=0;r<n.length;r++){var u=n[r];v(u)?e.push(N(u,t)):(u=t(u),$n(u)&&e.push(u))}return e}function g(n){return[].concat(n).reduce((function(n,t){return v(t)?n.concat(g(t)):[].concat(n).concat(t)}),[])}function E(n,t){var e=0;for(t=t.slice(0,-1);e<t.length;e++){var r=t[e];n[r]=d(n[r],[]),n=n[r]}return n}function m(n){return n.forEach((function(n){return n()}))}function y(n,t){if(!n)throw t instanceof String?t.valueOf():Error(t?p(t):t)}function R(n){return String(n)===n}function O(n){return!!n===n}function S(n){setTimeout((function(){throw Error(n)}),0)}function T(n,t){function e(n,t){n&&(r=!0,u=t)}for(var r=!1,u=null,i=0;i<n.length;i++)if(t(n[i],e,i),r)return u}function b(n){return!n||(Object.prototype.hasOwnProperty.call(n,"length")?u(n,0):"object"==typeof n&&u(Object.keys(n),0))}function C(n){return i(n,0)}function _(n,t){return R(n)&&R(t)&&n.endsWith(t)}function I(n,t){return n===t}function k(n,t){return r(n,t)||i(n,t)}function A(n,t){return!!(v(t)||R(t)&&R(n))&&-1!==t.indexOf(n)}function w(n,t){return e(n)&&e(t)&&Number(n)<Number(t)}function W(n,t){return r(n,t)||w(n,t)}function U(n,t,e){return k(n,t)&&W(n,e)}function x(n){return f(n)||R(n)&&!n.trim()}function F(n,t){return n in t}function L(n){return Number.isNaN(n)}function P(n){return"number"==typeof n}function G(n){return!!n}function D(n,t){if(f(t))return!1;for(var e in t)if(t[e]===n)return!0;return!1}function X(n,t){return t instanceof RegExp?t.test(n):!!R(t)&&new RegExp(t).test(n)}function q(n,t){return R(n)&&R(t)&&n.startsWith(t)}function j(n){for(var t in mt){var e=mt[t];l(e)&&n(t,e)}}function K(n){function t(t,u){var i,o,s=e();return t=rt({},s||{},null!==(i=p(n,t,s))&&void 0!==i?i:t),i=r.ctx=Object.freeze(t),r.ancestry.unshift(i),u=u(i),r.ancestry.shift(),r.ctx=null!==(o=r.ancestry[0])&&void 0!==o?o:null,u}function e(){return r.ctx}var r={ancestry:[]};return{bind:function(n,e){return function(){for(var r=[],u=0;u<arguments.length;u++)r[u]=arguments[u];return t(n,(function(){return e.apply(void 0,r)}))}},run:t,use:e,useX:function(n){var t=e();return y(t,d(n,"Context was used after it was closed")),t}}}function B(){return null}function H(n,t,e){if(e||2===arguments.length)for(var r,u=0,i=t.length;u<i;u++)!r&&u in t||(r||(r=Array.prototype.slice.call(t,0,u)),r[u]=t[u]);return n.concat(r||Array.prototype.slice.call(t))}function M(){try{return l(Proxy)}catch(n){return!1}}function V(n,t){return n={pass:n},t&&(n.message=t),n}function J(n,t,e){for(var r=[],u=3;u<arguments.length;u++)r[u-3]=arguments[u];return y(O(n)||n&&O(n.pass),"Incorrect return value for rule: "+JSON.stringify(n)),O(n)?V(n):V(n.pass,p.apply(void 0,H([n.message,t,e],r,!1)))}function Y(n){function t(t,e,r){return function(){for(var u=[],i=0;i<arguments.length;i++)u[i]=arguments[i];return y((i=yt.run({value:n},(function(){return J.apply(void 0,H([e.apply(void 0,H([n],u,!1)),r,n],u,!1))}))).pass,f(i.message)?"enforce/".concat(r," failed with ").concat(JSON.stringify(n)):new String(p(i.message))),t}}var e={};if(!M())return j((function(n,r){e[n]=t(e,r,n)})),e;var r=new Proxy(e,{get:function(n,e){if(n=mt[e])return t(r,n,e)}});return r}function z(n){var t,e=[];return function n(r){return function(){for(var u=[],i=0;i<arguments.length;i++)u[i]=arguments[i];var o=mt[r];e.push((function(n){return J.apply(void 0,H([o.apply(void 0,H([n],u,!1)),r,n],u,!1))}));var s={run:function(n){return d(T(e,(function(e,r){var u,i=yt.run({value:n},(function(){return e(n)}));r(!i.pass,V(!!i.pass,null!==(u=p(t,n,i.message))&&void 0!==u?u:i.message))})),V(!0))},test:function(n){return s.run(n).pass},message:function(n){return n&&(t=n),s}};return M()?s=new Proxy(s,{get:function(t,e){return mt[e]?n(e):t[e]}}):(j((function(t){s[t]=n(t)})),s)}}(n)}function Q(){var n=0;return{current:function(){return n},next:function(){n++}}}function Z(n,t){return void 0===t&&(t=[]),{cursor:Q(),keys:{current:{},prev:{}},path:t,type:n}}function $(){return St.useX().stateRef}function nn(n){return $().optionalFields()[0][n]}function tn(n,t){(0,$().optionalFields()[1])((function(e){var r;return rt(e,((r={})[n]=p(t,e[n]),r))}))}function en(n){var t;return null===(t=nn(n))||void 0===t?void 0:t[0]}function rn(){un((function(n){return n}))}function un(n){(0,$().testObjects()[1])((function(t){return{prev:t.prev,current:[].concat(n(t.current))}}))}function on(){return sn().filter((function(n){return n.isPending()}))}function sn(){var n=$().testObjects()[0].current;return Tt([n],(function(){return g(n)}))}function an(n){function t(n,t,u){return r.references.push(),e(n,p(t,u)),function(){return[r.references[n],function(t){return e(n,p(t,r.references[n]))}]}}function e(t,e){var i=r.references[t];r.references[t]=e,l(t=u[t][1])&&t(e,i),l(n)&&n()}var r={references:[]},u=[];return{registerStateKey:function(n,e){var r=u.length;return u.push([n,e]),t(r,n)},reset:function(){var n=r.references;r.references=[],u.forEach((function(e,r){return t(r,e[0],n[r])}))}}}function cn(n,t){var e=t.suiteId;return t=t.suiteName,{optionalFields:n.registerStateKey((function(){return{}})),suiteId:n.registerStateKey(e),suiteName:n.registerStateKey(t),testCallbacks:n.registerStateKey((function(){return{fieldCallbacks:{},doneCallbacks:[]}})),testObjects:n.registerStateKey((function(n){return{prev:n?n.current:[],current:[]}}))}}function fn(){return St.useX().isolate}function ln(){var n=fn();return n.path.concat(n.cursor.current())}function pn(n,t){n=void 0===(n=n.type)?Vn.DEFAULT:n,y(l(t));var e=Z(n,ln());return n=St.run({isolate:e},(function(){return e.keys.prev=function(){var n=$().testObjects()[0].prev;return[].concat(E(n,ln())).reduce((function(n,t){return t instanceof _t&&!f(t.key)?(n[t.key]=t,n):n}),{})}(),un((function(n){var t=e.path;return E(n,t)[h(t)]=[],n})),t()})),fn().cursor.next(),n}function dn(n,t){return!(!t||n.fieldName!==t)}function vn(n,t){return sn().some((function(e){return hn(e,n,t)}))}function hn(n,t,e){return(e=!n.hasFailures()||e&&!dn(n,e))||(n=n.warns(),e=t===bt.WARNINGS!=!!n),!e}function Nn(n){return!!gn(n)||!vn(bt.ERRORS,n)&&(!b(sn())&&!function(n){return it(on().filter((function(t){return En(t,n)})))}(n)&&function(n){return sn().every((function(t){return!(!n||dn(t,n))||mn(t,n)}))}(n))}function gn(n){return!!n&&!0===(null===(t=nn(n))||void 0===t?void 0:t[1]);var t}function En(n,t){return!(t&&!dn(n,t))&&!0!==en(n.fieldName)}function mn(n,t){return!(!t||dn(n,t))||(!0===en(n.fieldName)||n.isTested()||n.isOmitted())}function yn(){var n=sn(),t=rt({errorCount:0,warnCount:0,testCount:0},{groups:{},tests:{},valid:!1});return n.reduce((function(n,t){var e=n.tests;e[t.fieldName]=Rn(e,t),e[t.fieldName].valid=!1!==e[t.fieldName].valid&&Nn(t.fieldName);var r=n.groups,u=t.groupName;return u&&(r[u]=r[u]||{},r[u][t.fieldName]=Rn(r[u],t),e=r[u][t.fieldName],!1===r[u][t.fieldName].valid?t=!1:t=!!gn(t=t.fieldName)||!function(n,t,e){return sn().some((function(r){return!Pt(r,t)&&hn(r,n,e)}))}(bt.ERRORS,u,t)&&!function(n,t){return it(on().filter((function(e){return!Pt(e,n)&&En(e,t)})))}(u,t)&&function(n,t){return sn().every((function(e){return!!Pt(e,n)||mn(e,t)}))}(u,t),e.valid=t),n}),t),t.valid=Nn(),function(n){for(var t in n.tests)n.errorCount+=n.tests[t].errorCount,n.warnCount+=n.tests[t].warnCount,n.testCount+=n.tests[t].testCount;return n}(t)}function Rn(n,t){function e(n){i[n===bt.ERRORS?Ct.ERROR_COUNT:Ct.WARN_COUNT]++,u&&(i[n]=(i[n]||[]).concat(u))}var r=t.fieldName,u=t.message;n[r]=n[r]||rt({errorCount:0,warnCount:0,testCount:0},{errors:[],warnings:[]});var i=n[r];return t.isNonActionable()||(n[r].testCount++,t.isFailing()?e(bt.ERRORS):t.isWarning()&&e(bt.WARNINGS)),i}function On(n,t,e){if(e){var r;n=(null===(r=null==n?void 0:n[e])||void 0===r?void 0:r[t])||[]}else{for(var u in r={},e=t===bt.ERRORS?Ct.ERROR_COUNT:Ct.WARN_COUNT,n)C(n[u][e])&&(r[u]=n[u][t]||[]);n=r}return n}function Sn(n){return{getErrors:function(t){return On(n.tests,bt.ERRORS,t)},getErrorsByGroup:function(t,e){return On(n.groups[t],bt.ERRORS,e)},getWarnings:function(t){return On(n.tests,bt.WARNINGS,t)},getWarningsByGroup:function(t,e){return On(n.groups[t],bt.WARNINGS,e)},hasErrors:function(t){return Cn(n,Ct.ERROR_COUNT,t)},hasErrorsByGroup:function(t,e){return bn(n,Ct.ERROR_COUNT,t,e)},hasWarnings:function(t){return Cn(n,Ct.WARN_COUNT,t)},hasWarningsByGroup:function(t,e){return bn(n,Ct.WARN_COUNT,t,e)},isValid:function(t){var e;return t?!(null===(e=n.tests[t])||void 0===e||!e.valid):n.valid},isValidByGroup:function(t,e){if(!(t=n.groups[t]))return!1;if(e)return Tn(t,e);for(var r in t)if(!Tn(t,r))return!1;return!0}}}function Tn(n,t){var e;return!(null===(e=n[t])||void 0===e||!e.valid)}function bn(n,t,e,r){var u,i;if(!(n=n.groups[e]))return!1;if(r)return C(null===(u=n[r])||void 0===u?void 0:u[t]);for(var o in n)if(C(null===(i=n[o])||void 0===i?void 0:i[t]))return!0;return!1}function Cn(n,t,e){var r;return C(n=e?null===(r=n.tests[e])||void 0===r?void 0:r[t]:n[t]||0)}function _n(){var n=sn(),t={stateRef:$()};return Gt([n],St.bind(t,(function(){var n=yn(),t=$().suiteName()[0];return rt(n,Sn(n),{suiteName:t})})))}function In(n){var t=on();return!b(t)&&(!n||t.some((function(t){return dn(t,n)})))}function kn(){var n=sn(),t={stateRef:$()};return Dt([n],St.bind(t,(function(){return rt({},_n(),{done:St.bind(t,Xt)})})))}function An(n,t,e){var u;return!!(!l(n)||t&&r(null===(u=e.tests[t])||void 0===u?void 0:u.testCount,0))}function wn(n){return!(In()&&(!n||In(n)))}function Wn(n,t){(0,$().testCallbacks()[1])((function(e){return t?e.fieldCallbacks[t]=(e.fieldCallbacks[t]||[]).concat(n):e.doneCallbacks.push(n),e}))}function Un(){var n=function(){var n={};return{emit:function(t,e){(n[t]||[]).forEach((function(n){n(e)}))},on:function(t,e){return n[t]=(n[t]||[]).concat(e),{off:function(){n[t]=(n[t]||[]).filter((function(n){return n!==e}))}}}}}();return n.on(Lt.TEST_COMPLETED,(function(t){if(!t.isCanceled()){t.done(),t=t.fieldName;var e=$().testCallbacks()[0].fieldCallbacks;t&&!In(t)&&v(e[t])&&m(e[t]),In()||n.emit(Lt.ALL_RUNNING_TESTS_FINISHED)}})),n.on(Lt.SUITE_CALLBACK_DONE_RUNNING,(function(){!function(){function n(n){t[n.fieldName]&&(n.omit(),tn(n.fieldName,(function(n){return[n[0],!0]})))}if(!b($().optionalFields()[0])){var t={};un((function(e){return N(e,(function(e){if(Object.prototype.hasOwnProperty.call(t,e.fieldName))n(e);else{var r=en(e.fieldName);l(r)&&(t[e.fieldName]=r(),n(e))}return e}))}))}}()})),n.on(Lt.ALL_RUNNING_TESTS_FINISHED,(function(){m($().testCallbacks()[0].doneCallbacks)})),n.on(Lt.REMOVE_FIELD,(function(n){sn().forEach((function(t){dn(t,n)&&(t.cancel(),function(n){un((function(t){return N(t,(function(t){return n!==t?t:null}))}))}(t))}))})),n.on(Lt.RESET_FIELD,(function(n){sn().forEach((function(t){dn(t,n)&&t.reset()}))})),n}function xn(){var n=St.useX();return y(n.bus),n.bus}function Fn(n){return Pn(0,"tests",n)}function Ln(n){return Pn(1,"tests",n)}function Pn(n,t,e){var r=St.useX("hook called outside of a running suite.");e&&[].concat(e).forEach((function(e){R(e)&&(r.exclusion[t][e]=0===n)}))}function Gn(n){for(var t in n)if(!0===n[t])return!0;return!1}function Dn(){var n,t=St.useX().exclusion;for(n in t.groups)if(t.groups[n])return!0;return!1}function Xn(n){return"Wrong arguments passed to group. Group ".concat(n,".")}function qn(n){var t=n.asyncTest,e=n.message;if(t&&l(t.then)){var r=xn().emit,u=$(),i=St.bind({stateRef:u},(function(){rn(),r(Lt.TEST_COMPLETED,n)}));u=St.bind({stateRef:u},(function(t){n.isCanceled()||(n.message=R(t)?t:e,n.fail(),i())}));try{t.then(i,u)}catch(n){u()}}}function jn(n){var t=$().testObjects()[0].prev;if(b(t))return Kn(n),n;var e=ln();if(t=E(t,e)[h(e)],!f(n.key)){t=n.key,(e=fn().keys.prev[t])&&(n=e),e=n;var r=fn().keys.current;return f(r[t])?r[t]=e:S('Encountered the same test key "'.concat(t,"\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.")),Kn(n),n}return!it(e=t)||e.fieldName===n.fieldName&&e.groupName===n.groupName||(fn().type===Vn.EACH||S("Vest Critical Error: Tests called in different order than previous run.\n expected: ".concat(t.fieldName,"\n received: ").concat(n.fieldName,'\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.')),function(){var n=fn().cursor.current();un((function(t){return t.splice(n),t}))}(),t=null),Kn(n=d(t,n)),n}function Kn(n){var t=ln();un((function(e){return E(e,t)[h(t)]=n,e}))}function Bn(n){var t=fn().cursor,e=Yn.EAGER;if(St.useX().mode[0]===e&&vn(bt.ERRORS,n.fieldName))return n.skip(),jn(n),t.next(),n;if(e=jn(n),St.useX().omitted)return e.omit(),t.next(),e;if(function(n){var t=n.fieldName;if(n=n.groupName,St.useX().skipped)return!0;var e=St.useX(),r=e.exclusion;e=e.inclusion;var u=r.tests,i=u[t];if(!1===i)return!0;if(i=!0===i,n){var o=St.useX().exclusion.groups;if(o=Object.prototype.hasOwnProperty.call(o,n)?!1===o[n]:Dn())return!0;if(!0===r.groups[n])return!(i||!Gn(u)&&!1!==u[t])}return!!(n=!!Dn()&&!n)||!i&&!!Gn(u)&&!p(e[t])}(n))return e.skip(!!St.useX().skipped),t.next(),e;if(n!==e&&e.fieldName===n.fieldName&&e.groupName===n.groupName&&e.isPending()&&e.cancel(),Kn(n),n.isUntested()){e=xn();var r=function(n){return St.run({currentTest:n},(function(){return n.run()}))}(n);try{r&&l(r.then)?(n.asyncTest=r,n.setPending(),qn(n)):e.emit(Lt.TEST_COMPLETED,n)}catch(t){throw Error("Unexpected error encountered during test registration.\n Test Object: ".concat(JSON.stringify(n),".\n Error: ").concat(t,"."))}}else(e=n.asyncTest)&&l(e.then)&&(n.setPending(),qn(n));return t.next(),n}function Hn(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];var r=l(t[1])?t:H([void 0],t,!0);t=r[0],e=r[1],r=r[2],y(R(n),Mn("fieldName","string")),y(l(e),Mn("Test callback","function"));var u=St.useX();return Bn(t=new _t(n,e,{message:t,groupName:u.groupName,key:r}))}function Mn(n,t){return"Incompatible params passed to test function. ".concat(n," must be a ").concat(t)}var Vn,Jn,Yn,zn=t(e),Qn=t(r),Zn=t(u),$n=t(a),nt=t(c),tt=t(f),et=t(v),rt=Object.assign,ut=(Jn=0,function(){return"".concat(Jn++)}),it=t(b),ot=t(_),st=t(I),at=t(A),ct=t(U),ft=t(x),lt=t(O),pt=t(F),dt=t(L),vt=t(P),ht=t(R),Nt=t(G),gt=t(D),Et=t(X),mt={condition:function(n,t){try{return t(n)}catch(n){return!1}},doesNotEndWith:ot,doesNotStartWith:t(q),endsWith:_,equals:I,greaterThan:i,greaterThanOrEquals:k,gt:i,gte:k,inside:A,isArray:v,isBetween:U,isBlank:x,isBoolean:O,isEmpty:b,isEven:function(n){return!!e(n)&&0==n%2},isFalsy:Nt,isKeyOf:F,isNaN:L,isNegative:function(n){return w(n,0)},isNotArray:et,isNotBetween:ct,isNotBlank:ft,isNotBoolean:lt,isNotEmpty:it,isNotKeyOf:pt,isNotNaN:dt,isNotNull:$n,isNotNullish:tt,isNotNumber:vt,isNotNumeric:zn,isNotString:ht,isNotUndefined:nt,isNotValueOf:gt,isNull:a,isNullish:f,isNumber:P,isNumeric:e,isOdd:function(n){return!!e(n)&&0!=n%2},isPositive:C,isString:R,isTruthy:G,isUndefined:c,isValueOf:D,lengthEquals:u,lengthNotEquals:Zn,lessThan:w,lessThanOrEquals:W,longerThan:o,longerThanOrEquals:function(n,t){return k(n.length,t)},lt:w,lte:W,matches:X,notEquals:st,notInside:at,notMatches:Et,numberEquals:r,numberNotEquals:Qn,shorterThan:function(n,t){return w(n.length,t)},shorterThanOrEquals:function(n,t){return W(n.length,t)},startsWith:q},yt=K((function(n,t){var e={value:n.value,meta:n.meta||{}};return t?n.set?rt(e,{parent:function(){return t?{value:t.value,meta:t.meta,parent:t.parent}:t}}):t:rt(e,{parent:B})})),Rt=function(){function n(){if(!M())return j((function(n){t[n]=z(n)})),rt(Y,t)}var t={context:function(){return yt.useX()},extend:function(t){rt(mt,t),n()}};return n(),new Proxy(rt(Y,t),{get:function(n,t){return t in n?n[t]:mt[t]?z(t):void 0}})}();!function(n){n[n.DEFAULT=0]="DEFAULT",n[n.SUITE=1]="SUITE",n[n.EACH=2]="EACH",n[n.SKIP_WHEN=3]="SKIP_WHEN",n[n.OMIT_WHEN=4]="OMIT_WHEN",n[n.GROUP=5]="GROUP"}(Vn||(Vn={})),function(n){n[n.ALL=0]="ALL",n[n.EAGER=1]="EAGER"}(Yn||(Yn={}));var Ot,St=K((function(n,t){return t?null:rt({exclusion:{tests:{},groups:{}},inclusion:{},isolate:Z(Vn.DEFAULT),mode:[Yn.ALL]},n)})),Tt=s();!function(n){n.Error="error",n.Warning="warning"}(Ot||(Ot={}));var bt,Ct,_t=function(){function n(n,t,e){var r=void 0===e?{}:e;e=r.message;var u=r.groupName;r=r.key,this.key=null,this.id=ut(),this.severity=Ot.Error,this.status=It,this.fieldName=n,this.testFn=t,u&&(this.groupName=u),e&&(this.message=e),r&&(this.key=r)}return n.prototype.run=function(){try{var n=this.testFn()}catch(t){n=t,c(this.message)&&R(n)&&(this.message=t),n=!1}return!1===n&&this.fail(),n},n.prototype.setStatus=function(n){this.isFinalStatus()&&n!==Ft||(this.status=n)},n.prototype.warns=function(){return this.severity===Ot.Warning},n.prototype.setPending=function(){this.setStatus(Ut)},n.prototype.fail=function(){this.setStatus(this.warns()?wt:At)},n.prototype.done=function(){this.isFinalStatus()||this.setStatus(Wt)},n.prototype.warn=function(){this.severity=Ot.Warning},n.prototype.isFinalStatus=function(){return this.hasFailures()||this.isCanceled()||this.isPassing()},n.prototype.skip=function(n){this.isPending()&&!n||this.setStatus(kt)},n.prototype.cancel=function(){this.setStatus(xt),rn()},n.prototype.reset=function(){this.status=It,rn()},n.prototype.omit=function(){this.setStatus(Ft)},n.prototype.valueOf=function(){return!this.isFailing()},n.prototype.hasFailures=function(){return this.isFailing()||this.isWarning()},n.prototype.isNonActionable=function(){return this.isSkipped()||this.isOmitted()||this.isCanceled()},n.prototype.isPending=function(){return this.statusEquals(Ut)},n.prototype.isTested=function(){return this.hasFailures()||this.isPassing()},n.prototype.isOmitted=function(){return this.statusEquals(Ft)},n.prototype.isUntested=function(){return this.statusEquals(It)},n.prototype.isFailing=function(){return this.statusEquals(At)},n.prototype.isCanceled=function(){return this.statusEquals(xt)},n.prototype.isSkipped=function(){return this.statusEquals(kt)},n.prototype.isPassing=function(){return this.statusEquals(Wt)},n.prototype.isWarning=function(){return this.statusEquals(wt)},n.prototype.statusEquals=function(n){return this.status===n},n}(),It="UNTESTED",kt="SKIPPED",At="FAILED",wt="WARNING",Wt="PASSING",Ut="PENDING",xt="CANCELED",Ft="OMITTED";!function(n){n.WARNINGS="warnings",n.ERRORS="errors"}(bt||(bt={})),function(n){n.ERROR_COUNT="errorCount",n.WARN_COUNT="warnCount"}(Ct||(Ct={}));var Lt,Pt=t((function(n,t){return n.groupName===t})),Gt=s(1),Dt=s(20),Xt=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=(n=n.reverse())[0];if(n=n[1],t=kn(),An(e,n,t))return t;var r=function(){return e(_n())};return wn(n)?(r(),t):(Wn(r,n),t)};!function(n){n.TEST_COMPLETED="test_completed",n.ALL_RUNNING_TESTS_FINISHED="all_running_tests_finished",n.REMOVE_FIELD="remove_field",n.RESET_FIELD="reset_field",n.SUITE_CALLBACK_DONE_RUNNING="suite_callback_done_running"}(Lt||(Lt={})),Fn.group=function(n){return Pn(0,"groups",n)},Ln.group=function(n){return Pn(1,"groups",n)};var qt=rt(Hn,{memo:function(n){var t=s(10);return function(e){for(var r=[],u=1;u<arguments.length;u++)r[u-1]=arguments[u];u=fn().cursor.current();var i=(r=r.reverse())[0],o=r[1],s=r[2];return u=[$().suiteId()[0],e,u].concat(i),null===(r=t.get(u))?t(u,(function(){return n(e,s,o)})):r[1].isCanceled()?(t.invalidate(u),t(u,(function(){return n(e,s,o)}))):Bn(r[1])}}(Hn)});n.VERSION="4.5.0",n.context=St,n.create=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var e=(n=n.reverse())[0];n=n[1],y(l(e),"vest.create: Expected callback to be a function.");var r=Un(),u=an();return n={stateRef:cn(u,{suiteId:ut(),suiteName:n}),bus:r},rt(St.bind(n,(function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return u.reset(),pn({type:Vn.SUITE},(function(){e.apply(void 0,n)})),r.emit(Lt.SUITE_CALLBACK_DONE_RUNNING),kn()})),{get:St.bind(n,_n),remove:St.bind(n,(function(n){r.emit(Lt.REMOVE_FIELD,n)})),reset:u.reset,resetField:St.bind(n,(function(n){r.emit(Lt.RESET_FIELD,n)}))})},n.each=function(n,t){y(l(t),"each callback must be a function"),pn({type:Vn.EACH},(function(){n.forEach((function(n,e){t(n,e)}))}))},n.eager=function(){var n=Yn.EAGER;St.useX().mode[0]=n},n.enforce=Rt,n.group=function(n,t){y(R(n),Xn("name must be a string")),y(l(t),Xn("callback must be a function")),pn({type:Vn.GROUP},(function(){St.run({groupName:n},t)}))},n.include=function(n){var t=St.useX(),e=t.inclusion;return t=t.exclusion,y(R(n)),e[n]=d(t.tests[n],!0),{when:function(t){var e=St.useX(),r=e.exclusion;e.inclusion[n]=function(){return Object.prototype.hasOwnProperty.call(r.tests,n)?d(r.tests[n],!0):R(t)?!!r.tests[t]:p(t,p(_n))}}}},n.omitWhen=function(n,t){pn({type:Vn.OMIT_WHEN},(function(){St.run({omitted:!!St.useX().omitted||p(n,p(_n))},(function(){return t()}))}))},n.only=Fn,n.optional=function(n){if(v(n)||R(n))[].concat(n).forEach((function(n){tn(n,[!0,!1])}));else for(var t in n)tn(t,[n[t],!1])},n.skip=Ln,n.skipWhen=function(n,t){pn({type:Vn.SKIP_WHEN},(function(){St.run({skipped:!!St.useX().skipped||p(n,p(_n))},(function(){return t()}))}))},n.suiteSelectors=Sn,n.test=qt,n.warn=function(){var n=St.useX("warn hook called outside of a running suite.");y(n.currentTest,"warn called outside of a test."),n.currentTest.warn()},Object.defineProperty(n,"__esModule",{value:!0})}));
|
|
1
|
+
"use strict";!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("n4s"),require("vest-utils"),require("context"),require("vast")):"function"==typeof define&&define.amd?define(["exports","n4s","vest-utils","context","vast"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).vest={},t.n4s,t["vest-utils"],t.context,t.vast)}(this,(function(t,n,e,r,i){function u(){var t=0;return{current:function(){return t},next:function(){t++}}}function s(t,n){return void 0===n&&(n=[]),{cursor:u(),keys:{current:{},prev:{}},path:n,type:t}}function o(){return rt.useX().stateRef}function a(t,n){(0,o().optionalFields()[1])((function(r){var i;return e.assign(r,((i={})[t]=e.assign({},r[t],n(r[t])),i))}))}function c(t){var n;return null!==(n=o().optionalFields()[0][t])&&void 0!==n?n:{}}function f(){l((function(t){return t}))}function l(t){(0,o().testObjects()[1])((function(n){return{prev:n.prev,current:e.asArray(t(n.current))}}))}function d(){return p().filter((function(t){return t.isPending()}))}function p(){var t=o().testObjects()[0].current;return it([t],(function(){return e.nestedArray.flatten(t)}))}function v(t,n){var e=n.suiteId;return n=n.suiteName,{optionalFields:t.registerStateKey((function(){return{}})),suiteId:t.registerStateKey(e),suiteName:t.registerStateKey(n),testCallbacks:t.registerStateKey((function(){return{fieldCallbacks:{},doneCallbacks:[]}})),testObjects:t.registerStateKey((function(t){return{prev:t?t.current:[],current:[]}}))}}function E(){return rt.useX().isolate}function g(){var t=E();return t.path.concat(t.cursor.current())}function h(t,n){t=void 0===(t=t.type)?$.DEFAULT:t,e.invariant(e.isFunction(n));var r=s(t,g());return t=rt.run({isolate:r},(function(){return r.keys.prev=function(){var t=o().testObjects()[0].prev;return e.asArray(e.nestedArray.getCurrent(t,g())).reduce((function(t,n){return n instanceof ot&&!e.isNullish(n.key)?(t[n.key]=n,t):t}),{})}(),l((function(t){return e.nestedArray.setValueAtPath(t,r.path,[])})),n()})),E().cursor.next(),t}function N(t,n){return!(!n||t.fieldName!==n)}function m(t,n){return p().some((function(e){return y(e,t,n)}))}function y(t,n,r){return!(!t.hasFailures()||r&&!N(t,r)||e.either(n===ut.WARNINGS,t.warns()))}function R(t){return!!t&&c(t).applied}function S(t){if(R(t))return!0;var n=p();return!(e.isEmpty(n)||m(ut.ERRORS,t)||function(t){return e.isNotEmpty(d().filter((function(n){return T(n,t)})))}(t))&&function(t){return p().every((function(n){return C(n,t)}))}(t)}function T(t,n){return!(n&&!N(t,n))&&R(n)}function C(t,n){return!(!n||N(t,n))||(c(t.fieldName).type===gt.Delayed&&t.awaitsResolution()||t.isTested()||t.isOmitted())}function O(){var t=p(),n=e.assign({errorCount:0,warnCount:0,testCount:0},{groups:{},tests:{},valid:!1});return t.reduce((function(t,n){var r=t.tests;r[n.fieldName]=A(r,n),r[n.fieldName].valid=!1!==r[n.fieldName].valid&&S(n.fieldName);var i=t.groups,u=n.groupName;return u&&(i[u]=i[u]||{},i[u][n.fieldName]=A(i[u],n),r=i[u][n.fieldName],!1===i[u][n.fieldName].valid?n=!1:n=!!R(n=n.fieldName)||!function(t,n,e){return p().some((function(r){return!ht(r,n)&&y(r,t,e)}))}(ut.ERRORS,u,n)&&!function(t,n){return e.isNotEmpty(d().filter((function(e){return!ht(e,t)&&T(e,n)})))}(u,n)&&function(t,n){return p().every((function(e){return!!ht(e,t)||C(e,n)}))}(u,n),r.valid=n),t}),n),n.valid=S(),function(t){for(var n in t.tests)t.errorCount+=t.tests[n].errorCount,t.warnCount+=t.tests[n].warnCount,t.testCount+=t.tests[n].testCount;return t}(n)}function A(t,n){function r(t){s[t===ut.ERRORS?st.ERROR_COUNT:st.WARN_COUNT]++,u&&(s[t]=(s[t]||[]).concat(u))}var i=n.fieldName,u=n.message;t[i]=t[i]||e.assign({errorCount:0,warnCount:0,testCount:0},{errors:[],warnings:[]});var s=t[i];return n.isNonActionable()||(t[i].testCount++,n.isFailing()?r(ut.ERRORS):n.isWarning()&&r(ut.WARNINGS)),s}function _(t,n,r){if(r){var i;t=(null===(i=null==t?void 0:t[r])||void 0===i?void 0:i[n])||[]}else{for(var u in i={},r=n===ut.ERRORS?st.ERROR_COUNT:st.WARN_COUNT,t)e.isPositive(t[u][r])&&(i[u]=t[u][n]||[]);t=i}return t}function b(t){return{getErrors:function(n){return _(t.tests,ut.ERRORS,n)},getErrorsByGroup:function(n,e){return _(t.groups[n],ut.ERRORS,e)},getWarnings:function(n){return _(t.tests,ut.WARNINGS,n)},getWarningsByGroup:function(n,e){return _(t.groups[n],ut.WARNINGS,e)},hasErrors:function(n){return k(t,st.ERROR_COUNT,n)},hasErrorsByGroup:function(n,e){return F(t,st.ERROR_COUNT,n,e)},hasWarnings:function(n){return k(t,st.WARN_COUNT,n)},hasWarningsByGroup:function(n,e){return F(t,st.WARN_COUNT,n,e)},isValid:function(n){var e;return n?!(null===(e=t.tests[n])||void 0===e||!e.valid):t.valid},isValidByGroup:function(n,e){if(!(n=t.groups[n]))return!1;if(e)return I(n,e);for(var r in n)if(!I(n,r))return!1;return!0}}}function I(t,n){var e;return!(null===(e=t[n])||void 0===e||!e.valid)}function F(t,n,r,i){var u,s;if(!(t=t.groups[r]))return!1;if(i)return e.isPositive(null===(u=t[i])||void 0===u?void 0:u[n]);for(var o in t)if(e.isPositive(null===(s=t[o])||void 0===s?void 0:s[n]))return!0;return!1}function k(t,n,r){var i;return t=r?null===(i=t.tests[r])||void 0===i?void 0:i[n]:t[n]||0,e.isPositive(t)}function P(){var t=p(),n={stateRef:o()};return mt([t],rt.bind(n,(function(){var t=O(),n=o().suiteName()[0];return e.assign(t,b(t),{suiteName:n})})))}function U(t){var n=d();return!e.isEmpty(n)&&(!t||n.some((function(n){return N(n,t)})))}function L(){var t=p(),n={stateRef:o()};return yt([t],rt.bind(n,(function(){return e.assign({},P(),{done:rt.bind(n,Rt)})})))}function W(t,n,r){var i;return!!(!e.isFunction(t)||n&&e.numberEquals(null===(i=r.tests[n])||void 0===i?void 0:i.testCount,0))}function D(t){return!(U()&&(!t||U(t)))}function w(t,n){(0,o().testCallbacks()[1])((function(e){return n?e.fieldCallbacks[n]=(e.fieldCallbacks[n]||[]).concat(t):e.doneCallbacks.push(t),e}))}function G(){var t=e.bus.createBus();return t.on(Nt.TEST_COMPLETED,(function(n){if(!n.isCanceled()){n.done(),n=n.fieldName;var r=o().testCallbacks()[0].fieldCallbacks;n&&!U(n)&&e.isArray(r[n])&&e.callEach(r[n]),U()||t.emit(Nt.ALL_RUNNING_TESTS_FINISHED)}})),t.on(Nt.SUITE_CALLBACK_DONE_RUNNING,(function(){!function(){function t(t){r[t.fieldName]&&(t.omit(),a(t.fieldName,(function(){return{applied:!0}})))}var n=o().optionalFields()[0];if(!e.isEmpty(n)){var r={};p().forEach((function(n){if(e.hasOwnProperty(r,n.fieldName))t(n);else{var i=c(n.fieldName);i.type===gt.Immediate&&(r[n.fieldName]=e.optionalFunctionValue(i.rule),t(n))}})),f()}}()})),t.on(Nt.ALL_RUNNING_TESTS_FINISHED,(function(){var t=o().testCallbacks()[0].doneCallbacks;e.callEach(t)})),t.on(Nt.REMOVE_FIELD,(function(t){p().forEach((function(n){N(n,t)&&(n.cancel(),function(t){l((function(n){return e.nestedArray.transform(n,(function(n){return t!==n?n:null}))}))}(n))}))})),t.on(Nt.RESET_FIELD,(function(t){p().forEach((function(n){N(n,t)&&n.reset()}))})),t}function V(){var t=rt.useX();return e.invariant(t.bus),t.bus}function x(t){return q(0,"tests",t)}function X(t){return q(1,"tests",t)}function q(t,n,r){var i=rt.useX("hook called outside of a running suite.");r&&e.asArray(r).forEach((function(r){e.isStringValue(r)&&(i.exclusion[n][r]=0===t)}))}function H(t){for(var n in t)if(!0===t[n])return!0;return!1}function K(){var t,n=rt.useX().exclusion;for(t in n.groups)if(n.groups[t])return!0;return!1}function M(t){return"Wrong arguments passed to group. Group ".concat(t,".")}function j(t,n,e){if(e||2===arguments.length)for(var r,i=0,u=n.length;i<u;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return t.concat(r||Array.prototype.slice.call(n))}function B(t){var n=t.asyncTest,r=t.message;if(e.isPromise(n)){var i=V().emit,u=o(),s=rt.bind({stateRef:u},(function(){f(),i(Nt.TEST_COMPLETED,t)}));u=rt.bind({stateRef:u},(function(n){t.isCanceled()||(t.message=e.isStringValue(n)?n:r,t.fail(),s())})),n.then(s,u)}}function Y(t){var n=o().testObjects()[0].prev;if(e.isEmpty(n))return J(t),t;var r=g();if(n=e.nestedArray.valueAtPath(n,r),!e.isNullish(t.key)){n=t.key,(r=E().keys.prev[n])&&(t=r),r=t;var i=E().keys.current;return e.isNullish(i[n])?i[n]=r:e.deferThrow('Encountered the same test key "'.concat(n,"\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.")),J(t),t}return r=n,!e.isNotEmpty(r)||r.fieldName===t.fieldName&&r.groupName===t.groupName||(E().type===$.EACH||e.deferThrow("Vest Critical Error: Tests called in different order than previous run.\n expected: ".concat(n.fieldName,"\n received: ").concat(t.fieldName,'\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.')),function(){var t=E().cursor.current();l((function(n){return n.splice(t),n}))}(),n=null),J(t=e.defaultTo(n,t)),t}function J(t){var n=g();l((function(r){return e.nestedArray.setValueAtPath(r,n,t)}))}function z(t){var n=E().cursor,r=nt.EAGER;if(rt.useX().mode[0]===r&&m(ut.ERRORS,t.fieldName))return t.skip(),Y(t),n.next(),t;if(r=Y(t),rt.useX().omitted||R(t.fieldName))return r.omit(),n.next(),r;if(function(t){var n=t.fieldName;if(t=t.groupName,rt.useX().skipped)return!0;var r=rt.useX(),i=r.exclusion;r=r.inclusion;var u=i.tests,s=u[n];if(!1===s)return!0;if(s=!0===s,t){var o=rt.useX().exclusion.groups;if(o=e.hasOwnProperty(o,t)?!1===o[t]:K())return!0;if(!0===i.groups[t])return!(s||!H(u)&&!1!==u[n])}return!!(t=!!K()&&!t)||!s&&!!H(u)&&!e.optionalFunctionValue(r[n])}(t))return r.skip(!!rt.useX().skipped),n.next(),r;if(t!==r&&r.fieldName===t.fieldName&&r.groupName===t.groupName&&r.isPending()&&r.cancel(),J(t),t.isUntested()){r=V();var i=function(t){return rt.run({currentTest:t},(function(){return t.run()}))}(t);try{e.isPromise(i)?(t.asyncTest=i,t.setPending(),B(t)):r.emit(Nt.TEST_COMPLETED,t)}catch(n){throw Error("Unexpected error encountered during test registration.\n Test Object: ".concat(JSON.stringify(t),".\n Error: ").concat(n,"."))}}else e.isPromise(t.asyncTest)&&(t.setPending(),B(t));return n.next(),t}function Q(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=e.isFunction(n[1])?n:j([void 0],n,!0);n=i[0],r=i[1],i=i[2],e.invariant(e.isStringValue(t),Z("fieldName","string")),e.invariant(e.isFunction(r),Z("Test callback","function"));var u=rt.useX();return z(n=new ot(t,r,{message:n,groupName:u.groupName,key:i}))}function Z(t,n){return"Incompatible params passed to test function. ".concat(t," must be a ").concat(n)}var $,tt,nt;(tt=$||($={}))[tt.DEFAULT=0]="DEFAULT",tt[tt.SUITE=1]="SUITE",tt[tt.EACH=2]="EACH",tt[tt.SKIP_WHEN=3]="SKIP_WHEN",tt[tt.OMIT_WHEN=4]="OMIT_WHEN",tt[tt.GROUP=5]="GROUP",function(t){t[t.ALL=0]="ALL",t[t.EAGER=1]="EAGER"}(nt||(nt={}));var et,rt=r.createCascade((function(t,n){return n?null:e.assign({exclusion:{tests:{},groups:{}},inclusion:{},isolate:s($.DEFAULT),mode:[nt.ALL]},t)})),it=e.cache();!function(t){t.Error="error",t.Warning="warning"}(et||(et={}));var ut,st,ot=function(){function t(t,n,r){var i=void 0===r?{}:r;r=i.message;var u=i.groupName;i=i.key,this.key=null,this.id=e.seq(),this.severity=et.Error,this.status=at,this.fieldName=t,this.testFn=n,u&&(this.groupName=u),r&&(this.message=r),i&&(this.key=i)}return t.prototype.run=function(){try{var t=this.testFn()}catch(n){t=n,e.isUndefined(this.message)&&e.isStringValue(t)&&(this.message=n),t=!1}return!1===t&&this.fail(),t},t.prototype.setStatus=function(t){this.isFinalStatus()&&t!==Et||(this.status=t)},t.prototype.warns=function(){return this.severity===et.Warning},t.prototype.setPending=function(){this.setStatus(pt)},t.prototype.fail=function(){this.setStatus(this.warns()?lt:ft)},t.prototype.done=function(){this.isFinalStatus()||this.setStatus(dt)},t.prototype.warn=function(){this.severity=et.Warning},t.prototype.isFinalStatus=function(){return this.hasFailures()||this.isCanceled()||this.isPassing()},t.prototype.skip=function(t){this.isPending()&&!t||this.setStatus(ct)},t.prototype.cancel=function(){this.setStatus(vt),f()},t.prototype.reset=function(){this.status=at,f()},t.prototype.omit=function(){this.setStatus(Et)},t.prototype.valueOf=function(){return!this.isFailing()},t.prototype.isPending=function(){return this.statusEquals(pt)},t.prototype.isOmitted=function(){return this.statusEquals(Et)},t.prototype.isUntested=function(){return this.statusEquals(at)},t.prototype.isFailing=function(){return this.statusEquals(ft)},t.prototype.isCanceled=function(){return this.statusEquals(vt)},t.prototype.isSkipped=function(){return this.statusEquals(ct)},t.prototype.isPassing=function(){return this.statusEquals(dt)},t.prototype.isWarning=function(){return this.statusEquals(lt)},t.prototype.hasFailures=function(){return this.isFailing()||this.isWarning()},t.prototype.isNonActionable=function(){return this.isSkipped()||this.isOmitted()||this.isCanceled()},t.prototype.isTested=function(){return this.hasFailures()||this.isPassing()},t.prototype.awaitsResolution=function(){return this.isSkipped()||this.isUntested()||this.isPending()},t.prototype.statusEquals=function(t){return this.status===t},t}(),at="UNTESTED",ct="SKIPPED",ft="FAILED",lt="WARNING",dt="PASSING",pt="PENDING",vt="CANCELED",Et="OMITTED";!function(t){t.WARNINGS="warnings",t.ERRORS="errors"}(ut||(ut={})),function(t){t.ERROR_COUNT="errorCount",t.WARN_COUNT="warnCount"}(st||(st={}));var gt,ht=e.bindNot((function(t,n){return t.groupName===n}));!function(t){t[t.Immediate=0]="Immediate",t[t.Delayed=1]="Delayed"}(gt||(gt={}));var Nt,mt=e.cache(1),yt=e.cache(20),Rt=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=(t=t.reverse())[0];if(t=t[1],n=L(),W(e,t,n))return n;var r=function(){return e(P())};return D(t)?(r(),n):(w(r,t),n)};!function(t){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.SUITE_CALLBACK_DONE_RUNNING="suite_callback_done_running"}(Nt||(Nt={})),x.group=function(t){return q(0,"groups",t)},X.group=function(t){return q(1,"groups",t)},r=e.assign(Q,{memo:function(t){var n=e.cache(10);return function(r){for(var i=[],u=1;u<arguments.length;u++)i[u-1]=arguments[u];u=E().cursor.current();var s=(i=i.reverse())[0],a=i[1],c=i[2];return u=[o().suiteId()[0],r,u].concat(s),i=n.get(u),e.isNull(i)?n(u,(function(){return t(r,c,a)})):i[1].isCanceled()?(n.invalidate(u),n(u,(function(){return t(r,c,a)}))):z(i[1])}}(Q)}),Object.defineProperty(t,"enforce",{enumerable:!0,get:function(){return n.enforce}}),t.VERSION="4.6.2-dev-fcaa09",t.context=rt,t.create=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=(t=t.reverse())[0];t=t[1],e.invariant(e.isFunction(r),"vest.create: Expected callback to be a function.");var u=G(),s=i.createState();return t={stateRef:v(s,{suiteId:e.seq(),suiteName:t}),bus:u},e.assign(rt.bind(t,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return s.reset(),h({type:$.SUITE},(function(){r.apply(void 0,t)})),u.emit(Nt.SUITE_CALLBACK_DONE_RUNNING),L()})),{get:rt.bind(t,P),remove:rt.bind(t,(function(t){u.emit(Nt.REMOVE_FIELD,t)})),reset:s.reset,resetField:rt.bind(t,(function(t){u.emit(Nt.RESET_FIELD,t)}))})},t.each=function(t,n){e.invariant(e.isFunction(n),"each callback must be a function"),h({type:$.EACH},(function(){t.forEach((function(t,e){n(t,e)}))}))},t.eager=function(){var t=nt.EAGER;rt.useX().mode[0]=t},t.group=function(t,n){e.invariant(e.isStringValue(t),M("name must be a string")),e.invariant(e.isFunction(n),M("callback must be a function")),h({type:$.GROUP},(function(){rt.run({groupName:t},n)}))},t.include=function(t){var n=rt.useX(),r=n.inclusion;return n=n.exclusion,e.invariant(e.isStringValue(t)),r[t]=e.defaultTo(n.tests[t],!0),{when:function(n){var r=rt.useX(),i=r.exclusion;r.inclusion[t]=function(){return e.hasOwnProperty(i.tests,t)?e.defaultTo(i.tests[t],!0):e.isStringValue(n)?!!i.tests[n]:e.optionalFunctionValue(n,e.optionalFunctionValue(P))}}}},t.omitWhen=function(t,n){h({type:$.OMIT_WHEN},(function(){rt.run({omitted:!!rt.useX().omitted||e.optionalFunctionValue(t,e.optionalFunctionValue(P))},(function(){return n()}))}))},t.only=x,t.optional=function(t){if(e.isArray(t)||e.isStringValue(t))e.asArray(t).forEach((function(t){a(t,(function(){return{type:gt.Delayed,applied:!1,rule:null}}))}));else{var n,r=function(n){var r=t[n];a(n,(function(){return{type:gt.Immediate,rule:r,applied:e.optionalFunctionValue(r)}}))};for(n in t)r(n)}},t.skip=X,t.skipWhen=function(t,n){h({type:$.SKIP_WHEN},(function(){rt.run({skipped:!!rt.useX().skipped||e.optionalFunctionValue(t,e.optionalFunctionValue(P))},(function(){return n()}))}))},t.suiteSelectors=b,t.test=r,t.warn=function(){var t=rt.useX("warn hook called outside of a running suite.");e.invariant(t.currentTest,"warn called outside of a test."),t.currentTest.warn()},Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": "../dist/cjs/enforce_compose.js",
|
|
3
|
+
"module": "../dist/es/enforce_compose.production.js",
|
|
4
|
+
"unpkg": "../dist/umd/enforce_compose.production.js",
|
|
5
|
+
"jsdelivr": "../dist/umd/enforce_compose.production.js",
|
|
6
|
+
"name": "enforce_compose",
|
|
7
|
+
"types": "../types/enforce_compose.d.ts",
|
|
8
|
+
"private": true
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": "../dist/cjs/enforce_compounds.js",
|
|
3
|
+
"module": "../dist/es/enforce_compounds.production.js",
|
|
4
|
+
"unpkg": "../dist/umd/enforce_compounds.production.js",
|
|
5
|
+
"jsdelivr": "../dist/umd/enforce_compounds.production.js",
|
|
6
|
+
"name": "enforce_compounds",
|
|
7
|
+
"types": "../types/enforce_compounds.d.ts",
|
|
8
|
+
"private": true
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": "../dist/cjs/enforce_schema.js",
|
|
3
|
+
"module": "../dist/es/enforce_schema.production.js",
|
|
4
|
+
"unpkg": "../dist/umd/enforce_schema.production.js",
|
|
5
|
+
"jsdelivr": "../dist/umd/enforce_schema.production.js",
|
|
6
|
+
"name": "enforce_schema",
|
|
7
|
+
"types": "../types/enforce_schema.d.ts",
|
|
8
|
+
"private": true
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.6.2-dev-fcaa09",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "vest",
|
|
5
5
|
"author": "ealush",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
"url": "https://github.com/ealush/vest.git/issues"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"context": "^
|
|
24
|
-
"n4s": "^4.
|
|
25
|
-
"
|
|
23
|
+
"context": "^3.0.2-dev-fcaa09",
|
|
24
|
+
"n4s": "^4.2.2-dev-fcaa09",
|
|
25
|
+
"vast": "^1.0.13-dev-fcaa09",
|
|
26
|
+
"vest-utils": "^0.0.3-dev-fcaa09"
|
|
26
27
|
},
|
|
27
28
|
"homepage": "https://vestjs.dev/",
|
|
28
29
|
"exports": {
|
|
@@ -56,95 +57,95 @@
|
|
|
56
57
|
"module": "./dist/es/classnames.production.js",
|
|
57
58
|
"default": "./dist/cjs/classnames.production.js"
|
|
58
59
|
},
|
|
59
|
-
"./
|
|
60
|
+
"./enforce_compose": {
|
|
60
61
|
"production": {
|
|
61
|
-
"types": "./types/
|
|
62
|
-
"browser": "./dist/es/
|
|
63
|
-
"umd": "./dist/umd/
|
|
64
|
-
"import": "./dist/es/
|
|
65
|
-
"require": "./dist/cjs/
|
|
66
|
-
"node": "./dist/cjs/
|
|
67
|
-
"module": "./dist/es/
|
|
68
|
-
"default": "./dist/cjs/
|
|
62
|
+
"types": "./types/enforce_compose.d.ts",
|
|
63
|
+
"browser": "./dist/es/enforce_compose.production.js",
|
|
64
|
+
"umd": "./dist/umd/enforce_compose.production.js",
|
|
65
|
+
"import": "./dist/es/enforce_compose.production.js",
|
|
66
|
+
"require": "./dist/cjs/enforce_compose.production.js",
|
|
67
|
+
"node": "./dist/cjs/enforce_compose.production.js",
|
|
68
|
+
"module": "./dist/es/enforce_compose.production.js",
|
|
69
|
+
"default": "./dist/cjs/enforce_compose.production.js"
|
|
69
70
|
},
|
|
70
71
|
"development": {
|
|
71
|
-
"types": "./types/
|
|
72
|
-
"browser": "./dist/es/
|
|
73
|
-
"umd": "./dist/umd/
|
|
74
|
-
"import": "./dist/es/
|
|
75
|
-
"require": "./dist/cjs/
|
|
76
|
-
"node": "./dist/cjs/
|
|
77
|
-
"module": "./dist/es/
|
|
78
|
-
"default": "./dist/cjs/
|
|
72
|
+
"types": "./types/enforce_compose.d.ts",
|
|
73
|
+
"browser": "./dist/es/enforce_compose.development.js",
|
|
74
|
+
"umd": "./dist/umd/enforce_compose.development.js",
|
|
75
|
+
"import": "./dist/es/enforce_compose.development.js",
|
|
76
|
+
"require": "./dist/cjs/enforce_compose.development.js",
|
|
77
|
+
"node": "./dist/cjs/enforce_compose.development.js",
|
|
78
|
+
"module": "./dist/es/enforce_compose.development.js",
|
|
79
|
+
"default": "./dist/cjs/enforce_compose.development.js"
|
|
79
80
|
},
|
|
80
|
-
"types": "./types/
|
|
81
|
-
"browser": "./dist/es/
|
|
82
|
-
"umd": "./dist/umd/
|
|
83
|
-
"import": "./dist/es/
|
|
84
|
-
"require": "./dist/cjs/
|
|
85
|
-
"node": "./dist/cjs/
|
|
86
|
-
"module": "./dist/es/
|
|
87
|
-
"default": "./dist/cjs/
|
|
81
|
+
"types": "./types/enforce_compose.d.ts",
|
|
82
|
+
"browser": "./dist/es/enforce_compose.production.js",
|
|
83
|
+
"umd": "./dist/umd/enforce_compose.production.js",
|
|
84
|
+
"import": "./dist/es/enforce_compose.production.js",
|
|
85
|
+
"require": "./dist/cjs/enforce_compose.production.js",
|
|
86
|
+
"node": "./dist/cjs/enforce_compose.production.js",
|
|
87
|
+
"module": "./dist/es/enforce_compose.production.js",
|
|
88
|
+
"default": "./dist/cjs/enforce_compose.production.js"
|
|
88
89
|
},
|
|
89
|
-
"./
|
|
90
|
+
"./enforce_compounds": {
|
|
90
91
|
"production": {
|
|
91
|
-
"types": "./types/
|
|
92
|
-
"browser": "./dist/es/
|
|
93
|
-
"umd": "./dist/umd/
|
|
94
|
-
"import": "./dist/es/
|
|
95
|
-
"require": "./dist/cjs/
|
|
96
|
-
"node": "./dist/cjs/
|
|
97
|
-
"module": "./dist/es/
|
|
98
|
-
"default": "./dist/cjs/
|
|
92
|
+
"types": "./types/enforce_compounds.d.ts",
|
|
93
|
+
"browser": "./dist/es/enforce_compounds.production.js",
|
|
94
|
+
"umd": "./dist/umd/enforce_compounds.production.js",
|
|
95
|
+
"import": "./dist/es/enforce_compounds.production.js",
|
|
96
|
+
"require": "./dist/cjs/enforce_compounds.production.js",
|
|
97
|
+
"node": "./dist/cjs/enforce_compounds.production.js",
|
|
98
|
+
"module": "./dist/es/enforce_compounds.production.js",
|
|
99
|
+
"default": "./dist/cjs/enforce_compounds.production.js"
|
|
99
100
|
},
|
|
100
101
|
"development": {
|
|
101
|
-
"types": "./types/
|
|
102
|
-
"browser": "./dist/es/
|
|
103
|
-
"umd": "./dist/umd/
|
|
104
|
-
"import": "./dist/es/
|
|
105
|
-
"require": "./dist/cjs/
|
|
106
|
-
"node": "./dist/cjs/
|
|
107
|
-
"module": "./dist/es/
|
|
108
|
-
"default": "./dist/cjs/
|
|
102
|
+
"types": "./types/enforce_compounds.d.ts",
|
|
103
|
+
"browser": "./dist/es/enforce_compounds.development.js",
|
|
104
|
+
"umd": "./dist/umd/enforce_compounds.development.js",
|
|
105
|
+
"import": "./dist/es/enforce_compounds.development.js",
|
|
106
|
+
"require": "./dist/cjs/enforce_compounds.development.js",
|
|
107
|
+
"node": "./dist/cjs/enforce_compounds.development.js",
|
|
108
|
+
"module": "./dist/es/enforce_compounds.development.js",
|
|
109
|
+
"default": "./dist/cjs/enforce_compounds.development.js"
|
|
109
110
|
},
|
|
110
|
-
"types": "./types/
|
|
111
|
-
"browser": "./dist/es/
|
|
112
|
-
"umd": "./dist/umd/
|
|
113
|
-
"import": "./dist/es/
|
|
114
|
-
"require": "./dist/cjs/
|
|
115
|
-
"node": "./dist/cjs/
|
|
116
|
-
"module": "./dist/es/
|
|
117
|
-
"default": "./dist/cjs/
|
|
111
|
+
"types": "./types/enforce_compounds.d.ts",
|
|
112
|
+
"browser": "./dist/es/enforce_compounds.production.js",
|
|
113
|
+
"umd": "./dist/umd/enforce_compounds.production.js",
|
|
114
|
+
"import": "./dist/es/enforce_compounds.production.js",
|
|
115
|
+
"require": "./dist/cjs/enforce_compounds.production.js",
|
|
116
|
+
"node": "./dist/cjs/enforce_compounds.production.js",
|
|
117
|
+
"module": "./dist/es/enforce_compounds.production.js",
|
|
118
|
+
"default": "./dist/cjs/enforce_compounds.production.js"
|
|
118
119
|
},
|
|
119
|
-
"./
|
|
120
|
+
"./enforce_schema": {
|
|
120
121
|
"production": {
|
|
121
|
-
"types": "./types/
|
|
122
|
-
"browser": "./dist/es/
|
|
123
|
-
"umd": "./dist/umd/
|
|
124
|
-
"import": "./dist/es/
|
|
125
|
-
"require": "./dist/cjs/
|
|
126
|
-
"node": "./dist/cjs/
|
|
127
|
-
"module": "./dist/es/
|
|
128
|
-
"default": "./dist/cjs/
|
|
122
|
+
"types": "./types/enforce_schema.d.ts",
|
|
123
|
+
"browser": "./dist/es/enforce_schema.production.js",
|
|
124
|
+
"umd": "./dist/umd/enforce_schema.production.js",
|
|
125
|
+
"import": "./dist/es/enforce_schema.production.js",
|
|
126
|
+
"require": "./dist/cjs/enforce_schema.production.js",
|
|
127
|
+
"node": "./dist/cjs/enforce_schema.production.js",
|
|
128
|
+
"module": "./dist/es/enforce_schema.production.js",
|
|
129
|
+
"default": "./dist/cjs/enforce_schema.production.js"
|
|
129
130
|
},
|
|
130
131
|
"development": {
|
|
131
|
-
"types": "./types/
|
|
132
|
-
"browser": "./dist/es/
|
|
133
|
-
"umd": "./dist/umd/
|
|
134
|
-
"import": "./dist/es/
|
|
135
|
-
"require": "./dist/cjs/
|
|
136
|
-
"node": "./dist/cjs/
|
|
137
|
-
"module": "./dist/es/
|
|
138
|
-
"default": "./dist/cjs/
|
|
132
|
+
"types": "./types/enforce_schema.d.ts",
|
|
133
|
+
"browser": "./dist/es/enforce_schema.development.js",
|
|
134
|
+
"umd": "./dist/umd/enforce_schema.development.js",
|
|
135
|
+
"import": "./dist/es/enforce_schema.development.js",
|
|
136
|
+
"require": "./dist/cjs/enforce_schema.development.js",
|
|
137
|
+
"node": "./dist/cjs/enforce_schema.development.js",
|
|
138
|
+
"module": "./dist/es/enforce_schema.development.js",
|
|
139
|
+
"default": "./dist/cjs/enforce_schema.development.js"
|
|
139
140
|
},
|
|
140
|
-
"types": "./types/
|
|
141
|
-
"browser": "./dist/es/
|
|
142
|
-
"umd": "./dist/umd/
|
|
143
|
-
"import": "./dist/es/
|
|
144
|
-
"require": "./dist/cjs/
|
|
145
|
-
"node": "./dist/cjs/
|
|
146
|
-
"module": "./dist/es/
|
|
147
|
-
"default": "./dist/cjs/
|
|
141
|
+
"types": "./types/enforce_schema.d.ts",
|
|
142
|
+
"browser": "./dist/es/enforce_schema.production.js",
|
|
143
|
+
"umd": "./dist/umd/enforce_schema.production.js",
|
|
144
|
+
"import": "./dist/es/enforce_schema.production.js",
|
|
145
|
+
"require": "./dist/cjs/enforce_schema.production.js",
|
|
146
|
+
"node": "./dist/cjs/enforce_schema.production.js",
|
|
147
|
+
"module": "./dist/es/enforce_schema.production.js",
|
|
148
|
+
"default": "./dist/cjs/enforce_schema.production.js"
|
|
148
149
|
},
|
|
149
150
|
"./parser": {
|
|
150
151
|
"production": {
|
package/tsconfig.json
CHANGED
|
@@ -1,8 +1,92 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig.json",
|
|
3
|
+
"rootDir": ".",
|
|
3
4
|
"compilerOptions": {
|
|
5
|
+
"baseUrl": ".",
|
|
4
6
|
"declarationMap": true,
|
|
5
7
|
"declarationDir": "./types",
|
|
6
|
-
"outDir": "./dist"
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"paths": {
|
|
10
|
+
"ctx": ["src/core/ctx/ctx.ts"],
|
|
11
|
+
"generateIsolate": ["src/core/isolate/generateIsolate.ts"],
|
|
12
|
+
"isolate": ["src/core/isolate/isolate.ts"],
|
|
13
|
+
"isolateCursor": ["src/core/isolate/isolateCursor.ts"],
|
|
14
|
+
"isolateHooks": ["src/core/isolate/isolateHooks.ts"],
|
|
15
|
+
"each": ["src/core/isolate/isolates/each.ts"],
|
|
16
|
+
"group": ["src/core/isolate/isolates/group.ts"],
|
|
17
|
+
"omitWhen": ["src/core/isolate/isolates/omitWhen.ts"],
|
|
18
|
+
"skipWhen": ["src/core/isolate/isolates/skipWhen.ts"],
|
|
19
|
+
"IsolateTypes": ["src/core/isolate/IsolateTypes.ts"],
|
|
20
|
+
"createStateRef": ["src/core/state/createStateRef.ts"],
|
|
21
|
+
"stateHooks": ["src/core/state/stateHooks.ts"],
|
|
22
|
+
"create": ["src/core/suite/create.ts"],
|
|
23
|
+
"hasRemainingTests": ["src/core/suite/hasRemainingTests.ts"],
|
|
24
|
+
"produceSuiteResult": ["src/core/suite/produce/produceSuiteResult.ts"],
|
|
25
|
+
"produceSuiteRunResult": [
|
|
26
|
+
"src/core/suite/produce/produceSuiteRunResult.ts"
|
|
27
|
+
],
|
|
28
|
+
"runCallbacks": ["src/core/suite/produce/runCallbacks.ts"],
|
|
29
|
+
"Severity": ["src/core/suite/produce/Severity.ts"],
|
|
30
|
+
"genTestsSummary": [
|
|
31
|
+
"src/core/suite/produce/summaryGenerators/genTestsSummary.ts"
|
|
32
|
+
],
|
|
33
|
+
"hasFailuresByTestObjects": [
|
|
34
|
+
"src/core/suite/produce/summaryGenerators/hasFailuresByTestObjects.ts"
|
|
35
|
+
],
|
|
36
|
+
"matchingFieldName": [
|
|
37
|
+
"src/core/suite/produce/summaryGenerators/helpers/matchingFieldName.ts"
|
|
38
|
+
],
|
|
39
|
+
"matchingGroupName": [
|
|
40
|
+
"src/core/suite/produce/summaryGenerators/helpers/matchingGroupName.ts"
|
|
41
|
+
],
|
|
42
|
+
"nonMatchingSeverityProfile": [
|
|
43
|
+
"src/core/suite/produce/summaryGenerators/helpers/nonMatchingSeverityProfile.ts"
|
|
44
|
+
],
|
|
45
|
+
"shouldAddValidProperty": [
|
|
46
|
+
"src/core/suite/produce/summaryGenerators/shouldAddValidProperty.ts"
|
|
47
|
+
],
|
|
48
|
+
"SuiteSummaryTypes": [
|
|
49
|
+
"src/core/suite/produce/summaryGenerators/SuiteSummaryTypes.ts"
|
|
50
|
+
],
|
|
51
|
+
"collectFailures": [
|
|
52
|
+
"src/core/suite/produce/summarySelectors/collectFailures.ts"
|
|
53
|
+
],
|
|
54
|
+
"suiteSelectors": [
|
|
55
|
+
"src/core/suite/produce/summarySelectors/suiteSelectors.ts"
|
|
56
|
+
],
|
|
57
|
+
"key": ["src/core/test/key.ts"],
|
|
58
|
+
"cancelOverriddenPendingTest": [
|
|
59
|
+
"src/core/test/lib/cancelOverriddenPendingTest.ts"
|
|
60
|
+
],
|
|
61
|
+
"isSameProfileTest": ["src/core/test/lib/isSameProfileTest.ts"],
|
|
62
|
+
"registerPrevRunTest": ["src/core/test/lib/registerPrevRunTest.ts"],
|
|
63
|
+
"registerTest": ["src/core/test/lib/registerTest.ts"],
|
|
64
|
+
"removeTestFromState": ["src/core/test/lib/removeTestFromState.ts"],
|
|
65
|
+
"shouldUseErrorAsMessage": [
|
|
66
|
+
"src/core/test/lib/shouldUseErrorAsMessage.ts"
|
|
67
|
+
],
|
|
68
|
+
"useTestAtCursor": ["src/core/test/lib/useTestAtCursor.ts"],
|
|
69
|
+
"omitOptionalFields": ["src/core/test/omitOptionalFields.ts"],
|
|
70
|
+
"runAsyncTest": ["src/core/test/runAsyncTest.ts"],
|
|
71
|
+
"runSyncTest": ["src/core/test/runSyncTest.ts"],
|
|
72
|
+
"test.memo": ["src/core/test/test.memo.ts"],
|
|
73
|
+
"test": ["src/core/test/test.ts"],
|
|
74
|
+
"VestTest": ["src/core/test/VestTest.ts"],
|
|
75
|
+
"vestBus": ["src/core/vestBus.ts"],
|
|
76
|
+
"classnames": ["src/exports/classnames.ts"],
|
|
77
|
+
"enforce_compose": ["src/exports/enforce_compose.ts"],
|
|
78
|
+
"enforce_compounds": ["src/exports/enforce_compounds.ts"],
|
|
79
|
+
"enforce_schema": ["src/exports/enforce_schema.ts"],
|
|
80
|
+
"parser": ["src/exports/parser.ts"],
|
|
81
|
+
"promisify": ["src/exports/promisify.ts"],
|
|
82
|
+
"exclusive": ["src/hooks/exclusive.ts"],
|
|
83
|
+
"hookErrors": ["src/hooks/hookErrors.ts"],
|
|
84
|
+
"include": ["src/hooks/include.ts"],
|
|
85
|
+
"mode": ["src/hooks/mode/mode.ts"],
|
|
86
|
+
"Modes": ["src/hooks/mode/Modes.ts"],
|
|
87
|
+
"optionalFields": ["src/hooks/optionalFields.ts"],
|
|
88
|
+
"warn": ["src/hooks/warn.ts"],
|
|
89
|
+
"vest": ["src/vest.ts"]
|
|
90
|
+
}
|
|
7
91
|
}
|
|
8
92
|
}
|
package/types/classnames.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classnames.d.ts","sourceRoot":"","sources":["../src/exports/classnames.ts","../src/core/suite/produce/summaryGenerators/SuiteSummaryTypes.ts","../src/exports/parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAKA;;GAEG;AACH,iBAAwB,UAAU,CAChC,GAAG,EAAE,YAAY,EACjB,OAAO,GAAE,gBAAqB,GAC7B,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAe/B;AAED,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce_compose.d.ts","sourceRoot":"","sources":["../src/exports/enforce_compose.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce_compounds.d.ts","sourceRoot":"","sources":["../src/exports/enforce_compounds.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce_schema.d.ts","sourceRoot":"","sources":["../src/exports/enforce_schema.ts"],"names":[],"mappings":""}
|
package/types/parser.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/exports/parser.ts","../src/core/suite/produce/summaryGenerators/SuiteSummaryTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,iBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,CAuC7D;AAED,UAAU,gBAAgB;IACxB,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC"}
|
package/types/promisify.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promisify.d.ts","sourceRoot":"","sources":["../src/exports/promisify.ts","../src/core/suite/produce/summaryGenerators/SuiteSummaryTypes.ts","../src/core/test/lib/shouldUseErrorAsMessage.ts","../src/hooks/optionalFields.ts","../src/core/state/createStateRef.ts","../src/hooks/mode/Modes.ts","../src/core/isolate/isolateCursor.ts","../src/core/isolate/generateIsolate.ts","../src/core/ctx/ctx.ts","../src/core/state/stateHooks.ts","../src/core/test/VestTest.ts","../src/core/isolate/IsolateTypes.ts","../src/core/isolate/isolateHooks.ts","../src/core/test/key.ts","../src/core/isolate/isolate.ts","../src/core/suite/produce/summaryGenerators/helpers/matchingFieldName.ts","../src/core/suite/hasRemainingTests.ts","../src/core/suite/produce/produceSuiteRunResult.ts","../src/core/test/omitOptionalFields.ts","../src/core/test/lib/removeTestFromState.ts","../src/core/suite/produce/runCallbacks.ts","../src/core/vestBus.ts","../src/core/suite/create.ts","../src/core/suite/produce/Severity.ts","../src/core/suite/produce/summaryGenerators/helpers/matchingGroupName.ts","../src/core/suite/produce/summaryGenerators/helpers/nonMatchingSeverityProfile.ts","../src/core/suite/produce/summaryGenerators/hasFailuresByTestObjects.ts","../src/core/suite/produce/summaryGenerators/shouldAddValidProperty.ts","../src/core/suite/produce/summaryGenerators/genTestsSummary.ts","../src/core/suite/produce/summarySelectors/collectFailures.ts","../src/core/suite/produce/summarySelectors/suiteSelectors.ts","../src/core/suite/produce/produceSuiteResult.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,QAAA,MAAM,SAAS,0BACW,GAAG,EAAE,KAAK,cAAc,eACtC,GAAG,EAAE,KAAG,QAAQ,WAAW,CAOpC,CAAC"}
|
package/types/vest.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { enforce } from 'n4s';
|
|
2
|
+
import { CB, nestedArray } from "vest-utils";
|
|
3
|
+
import { UseState } from "vast";
|
|
2
4
|
type SuiteSummary = {
|
|
3
5
|
groups: Groups;
|
|
4
6
|
tests: Tests;
|
|
@@ -51,10 +53,7 @@ declare class VestTest {
|
|
|
51
53
|
reset(): void;
|
|
52
54
|
omit(): void;
|
|
53
55
|
valueOf(): boolean;
|
|
54
|
-
hasFailures(): boolean;
|
|
55
|
-
isNonActionable(): boolean;
|
|
56
56
|
isPending(): boolean;
|
|
57
|
-
isTested(): boolean;
|
|
58
57
|
isOmitted(): boolean;
|
|
59
58
|
isUntested(): boolean;
|
|
60
59
|
isFailing(): boolean;
|
|
@@ -62,13 +61,16 @@ declare class VestTest {
|
|
|
62
61
|
isSkipped(): boolean;
|
|
63
62
|
isPassing(): boolean;
|
|
64
63
|
isWarning(): boolean;
|
|
64
|
+
hasFailures(): boolean;
|
|
65
|
+
isNonActionable(): boolean;
|
|
66
|
+
isTested(): boolean;
|
|
67
|
+
awaitsResolution(): boolean;
|
|
65
68
|
statusEquals(status: KStatus): boolean;
|
|
66
69
|
}
|
|
67
70
|
type AsyncTest = Promise<string | void>;
|
|
68
71
|
type TestResult = AsyncTest | boolean | void;
|
|
69
72
|
type TestFn = () => TestResult;
|
|
70
73
|
type KStatus = "UNTESTED" | "SKIPPED" | "FAILED" | "WARNING" | "PASSING" | "PENDING" | "CANCELED" | "OMITTED";
|
|
71
|
-
type CB = (...args: any[]) => any;
|
|
72
74
|
// eslint-disable-next-line max-lines-per-function, max-statements
|
|
73
75
|
declare function suiteSelectors(summary: SuiteSummary): SuiteSelectors;
|
|
74
76
|
interface SuiteSelectors {
|
|
@@ -151,13 +153,35 @@ declare enum Modes {
|
|
|
151
153
|
ALL = 0,
|
|
152
154
|
EAGER = 1
|
|
153
155
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Marks a field as optional, either just by name, or by a given condition.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
*
|
|
161
|
+
* optional('field_name');
|
|
162
|
+
*
|
|
163
|
+
* optional({
|
|
164
|
+
* username: () => allowUsernameEmpty,
|
|
165
|
+
* });
|
|
166
|
+
*/
|
|
167
|
+
declare function optional(optionals: OptionalsInput): void;
|
|
168
|
+
type OptionalsInput = string | string[] | OptionalsObject;
|
|
169
|
+
type OptionalsObject = Record<string, (() => boolean) | boolean>;
|
|
170
|
+
type ImmediateOptionalFieldDeclaration = {
|
|
171
|
+
type: OptionalFieldTypes.Immediate;
|
|
172
|
+
rule: boolean | (() => boolean);
|
|
173
|
+
applied: boolean;
|
|
174
|
+
};
|
|
175
|
+
type DelayedOptionalFieldDeclaration = {
|
|
176
|
+
type: OptionalFieldTypes.Delayed;
|
|
177
|
+
applied: boolean;
|
|
178
|
+
rule: null;
|
|
179
|
+
};
|
|
180
|
+
type OptionalFieldDeclaration = ImmediateOptionalFieldDeclaration | DelayedOptionalFieldDeclaration;
|
|
181
|
+
declare enum OptionalFieldTypes {
|
|
182
|
+
Immediate = 0,
|
|
183
|
+
Delayed = 1
|
|
184
|
+
}
|
|
161
185
|
type StateRef = {
|
|
162
186
|
optionalFields: UseState<OptionalFields>;
|
|
163
187
|
suiteId: UseState<string>;
|
|
@@ -165,10 +189,7 @@ type StateRef = {
|
|
|
165
189
|
testCallbacks: UseState<TestCallbacks>;
|
|
166
190
|
testObjects: UseState<TestObjects>;
|
|
167
191
|
};
|
|
168
|
-
type OptionalFields = Record<string,
|
|
169
|
-
rule: (() => boolean) | boolean,
|
|
170
|
-
isApplied: boolean
|
|
171
|
-
]>;
|
|
192
|
+
type OptionalFields = Record<string, OptionalFieldDeclaration>;
|
|
172
193
|
type TestCallbacks = {
|
|
173
194
|
fieldCallbacks: Record<string, Array<(res: SuiteResult) => void>>;
|
|
174
195
|
doneCallbacks: Array<(res: SuiteResult) => void>;
|
|
@@ -177,13 +198,8 @@ type TestObjects = {
|
|
|
177
198
|
prev: VestTests;
|
|
178
199
|
current: VestTests;
|
|
179
200
|
};
|
|
180
|
-
type VestTests = NestedArray<VestTest>;
|
|
181
|
-
declare const _default:
|
|
182
|
-
run: <R>(ctxRef: Partial<CTXType>, fn: (context: CTXType) => R) => R;
|
|
183
|
-
bind: <Fn extends (...args: any[]) => any>(ctxRef: Partial<CTXType>, fn: Fn) => Fn;
|
|
184
|
-
use: () => CTXType | undefined;
|
|
185
|
-
useX: (errorMessage?: string | undefined) => CTXType;
|
|
186
|
-
};
|
|
201
|
+
type VestTests = nestedArray.NestedArray<VestTest>;
|
|
202
|
+
declare const _default: import("context").CtxCascadeApi<CTXType>;
|
|
187
203
|
type CTXType = {
|
|
188
204
|
isolate: Isolate;
|
|
189
205
|
stateRef?: StateRef;
|
|
@@ -287,20 +303,6 @@ declare function eager(): void;
|
|
|
287
303
|
* });
|
|
288
304
|
*/
|
|
289
305
|
declare function omitWhen(conditional: boolean | ((draft: SuiteResult) => boolean), callback: CB): void;
|
|
290
|
-
/**
|
|
291
|
-
* Marks a field as optional, either just by name, or by a given condition.
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
*
|
|
295
|
-
* optional('field_name');
|
|
296
|
-
*
|
|
297
|
-
* optional({
|
|
298
|
-
* username: () => allowUsernameEmpty,
|
|
299
|
-
* });
|
|
300
|
-
*/
|
|
301
|
-
declare function optional(optionals: OptionalsInput): void;
|
|
302
|
-
type OptionalsInput = string | string[] | OptionalsObject;
|
|
303
|
-
type OptionalsObject = Record<string, () => boolean>;
|
|
304
306
|
/**
|
|
305
307
|
* Conditionally skips running tests within the callback.
|
|
306
308
|
*
|
|
@@ -334,6 +336,7 @@ declare const test: typeof testBase & {
|
|
|
334
336
|
* Sets a running test to warn only mode.
|
|
335
337
|
*/
|
|
336
338
|
declare function warn(): void;
|
|
337
|
-
declare const VERSION = "4.
|
|
339
|
+
declare const VERSION = "4.6.2-dev-fcaa09";
|
|
338
340
|
export { suiteSelectors, test, create, each, only, skip, warn, group, optional, skipWhen, omitWhen, enforce, VERSION, context, include, eager };
|
|
339
341
|
export type { SuiteResult, SuiteRunResult, SuiteSummary, VestTest, Suite };
|
|
342
|
+
//# sourceMappingURL=vest.d.ts.map
|