vest 5.0.0-dev-040354 → 5.0.0-dev-9c596e

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 (70) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +2 -57
  3. package/dist/cjs/classnames.development.js +38 -17
  4. package/dist/cjs/classnames.production.js +1 -1
  5. package/dist/cjs/enforce/compose.development.js +5 -54
  6. package/dist/cjs/enforce/compose.production.js +1 -1
  7. package/dist/cjs/enforce/compounds.development.js +20 -83
  8. package/dist/cjs/enforce/compounds.production.js +1 -1
  9. package/dist/cjs/enforce/schema.development.js +19 -82
  10. package/dist/cjs/enforce/schema.production.js +1 -1
  11. package/dist/cjs/parser.development.js +31 -9
  12. package/dist/cjs/parser.production.js +1 -1
  13. package/dist/cjs/promisify.development.js +22 -9
  14. package/dist/cjs/promisify.production.js +1 -1
  15. package/dist/cjs/vest.development.js +1421 -1223
  16. package/dist/cjs/vest.production.js +1 -1
  17. package/dist/es/classnames.development.js +40 -19
  18. package/dist/es/classnames.production.js +1 -1
  19. package/dist/es/enforce/compose.development.js +1 -58
  20. package/dist/es/enforce/compose.production.js +1 -1
  21. package/dist/es/enforce/compounds.development.js +2 -90
  22. package/dist/es/enforce/compounds.production.js +1 -1
  23. package/dist/es/enforce/schema.development.js +2 -88
  24. package/dist/es/enforce/schema.production.js +1 -1
  25. package/dist/es/parser.development.js +32 -10
  26. package/dist/es/parser.production.js +1 -1
  27. package/dist/es/promisify.development.js +23 -10
  28. package/dist/es/promisify.production.js +1 -1
  29. package/dist/es/vest.development.js +1415 -1214
  30. package/dist/es/vest.production.js +1 -1
  31. package/dist/umd/classnames.development.js +41 -20
  32. package/dist/umd/classnames.production.js +1 -1
  33. package/dist/umd/enforce/compose.development.js +9 -57
  34. package/dist/umd/enforce/compose.production.js +1 -1
  35. package/dist/umd/enforce/compounds.development.js +32 -94
  36. package/dist/umd/enforce/compounds.production.js +1 -1
  37. package/dist/umd/enforce/schema.development.js +32 -94
  38. package/dist/umd/enforce/schema.production.js +1 -1
  39. package/dist/umd/parser.development.js +34 -12
  40. package/dist/umd/parser.production.js +1 -1
  41. package/dist/umd/promisify.development.js +25 -12
  42. package/dist/umd/promisify.production.js +1 -1
  43. package/dist/umd/vest.development.js +1423 -1225
  44. package/dist/umd/vest.production.js +1 -1
  45. package/package.json +12 -16
  46. package/testUtils/TVestMock.ts +7 -0
  47. package/testUtils/__tests__/partition.test.ts +4 -4
  48. package/testUtils/mockThrowError.ts +4 -2
  49. package/testUtils/suiteDummy.ts +4 -1
  50. package/testUtils/testDummy.ts +12 -10
  51. package/testUtils/testPromise.ts +3 -0
  52. package/types/classnames.d.ts +63 -12
  53. package/types/classnames.d.ts.map +1 -0
  54. package/types/enforce/compose.d.ts +2 -126
  55. package/types/enforce/compose.d.ts.map +1 -0
  56. package/types/enforce/compounds.d.ts +2 -136
  57. package/types/enforce/compounds.d.ts.map +1 -0
  58. package/types/enforce/schema.d.ts +2 -144
  59. package/types/enforce/schema.d.ts.map +1 -0
  60. package/types/parser.d.ts +69 -18
  61. package/types/parser.d.ts.map +1 -0
  62. package/types/promisify.d.ts +60 -42
  63. package/types/promisify.d.ts.map +1 -0
  64. package/types/vest.d.ts +246 -243
  65. package/types/vest.d.ts.map +1 -0
  66. package/CHANGELOG.md +0 -87
  67. package/testUtils/expandStateRef.ts +0 -8
  68. package/testUtils/runCreateRef.ts +0 -10
  69. package/testUtils/testObjects.ts +0 -6
  70. package/tsconfig.json +0 -8
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vest"),require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","vest","vest-utils"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).parser={},e.vest,e["vest-utils"])}(this,(function(e,t,s){e.parse=function(e){s.invariant(e&&s.hasOwnProperty(e,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var i=t.suiteSelectors(e),n={},r={invalid:i.hasErrors,tested:function(t){return t?s.hasOwnProperty(n,t)?n[t]:(n[t]=s.hasOwnProperty(e.tests,t)&&s.isPositive(e.tests[t].testCount),r.tested(t)):s.isPositive(e.testCount)},untested:function(t){return!(s.isPositive(e.testCount)&&r.tested(t))},valid:i.isValid,warning:i.hasWarnings};return r},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vest"),require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","vest","vest-utils"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).parser={},e.vest,e["vest-utils"])}(this,(function(e,t,s){"use strict";var n;!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}."}(n||(n={})),e.parse=function(e){s.invariant(e&&s.hasOwnProperty(e,"valid"),n.PARSER_EXPECT_RESULT_OBJECT);const i=t.suiteSelectors(e),o={},r={invalid:i.hasErrors,tested:function(t){if(s.isNullish(t))return s.isPositive(e.testCount);if(s.hasOwnProperty(o,t))return o[t];return a(t),r.tested(t)},untested:function(t){return!(s.isPositive(e.testCount)&&r.tested(t))},valid:i.isValid,warning:i.hasWarnings};return r;function a(t){o[t]=s.hasOwnProperty(e.tests,t)&&s.isPositive(e.tests[t].testCount)}},Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1,20 +1,33 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vest-utils')) :
3
3
  typeof define === 'function' && define.amd ? define(['vest-utils'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.promisify = factory(global['vest-utils']));
5
- }(this, (function (vestUtils) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.promisify = factory(global["vest-utils"]));
5
+ })(this, (function (vestUtils) { 'use strict';
6
6
 
7
- var promisify = function (validatorFn) {
8
- return function () {
9
- var args = [];
10
- for (var _i = 0; _i < arguments.length; _i++) {
11
- args[_i] = arguments[_i];
12
- }
13
- vestUtils.invariant(vestUtils.isFunction(validatorFn), 'promisify: Expected validatorFn to be a function.');
14
- return new Promise(function (resolve) { return validatorFn.apply(void 0, args).done(resolve); });
7
+ var ErrorStrings;
8
+ (function (ErrorStrings) {
9
+ ErrorStrings["HOOK_CALLED_OUTSIDE"] = "hook called outside of a running suite.";
10
+ ErrorStrings["EXPECTED_VEST_TEST"] = "Expected value to be an instance of IsolateTest";
11
+ ErrorStrings["FIELD_NAME_REQUIRED"] = "Field name must be passed";
12
+ ErrorStrings["SUITE_MUST_BE_INITIALIZED_WITH_FUNCTION"] = "Suite must be initialized with a function";
13
+ ErrorStrings["NO_ACTIVE_ISOLATE"] = "Not within an active isolate";
14
+ ErrorStrings["PROMISIFY_REQUIRE_FUNCTION"] = "Vest.Promisify must be called with a function";
15
+ ErrorStrings["PARSER_EXPECT_RESULT_OBJECT"] = "Vest parser: expected argument at position 0 to be Vest's result object.";
16
+ ErrorStrings["WARN_MUST_BE_CALLED_FROM_TEST"] = "Warn must be called from within the body of a test function";
17
+ ErrorStrings["EACH_CALLBACK_MUST_BE_A_FUNCTION"] = "Each must be called with a function";
18
+ ErrorStrings["INVALID_PARAM_PASSED_TO_FUNCTION"] = "Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}";
19
+ 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.";
20
+ 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.";
21
+ 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}.";
22
+ })(ErrorStrings || (ErrorStrings = {}));
23
+
24
+ function promisify(validatorFn) {
25
+ return (...args) => {
26
+ vestUtils.invariant(vestUtils.isFunction(validatorFn), ErrorStrings.PROMISIFY_REQUIRE_FUNCTION);
27
+ return new Promise(resolve => validatorFn(...args).done(resolve));
15
28
  };
16
- };
29
+ }
17
30
 
18
31
  return promisify;
19
32
 
20
- })));
33
+ }));
@@ -1 +1 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("vest-utils")):"function"==typeof define&&define.amd?define(["vest-utils"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).promisify=n(e["vest-utils"])}(this,(function(e){return function(n){return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return e.invariant(e.isFunction(n),"promisify: Expected validatorFn to be a function."),new Promise((function(e){return n.apply(void 0,t).done(e)}))}}}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vest-utils")):"function"==typeof define&&define.amd?define(["vest-utils"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).promisify=t(e["vest-utils"])}(this,(function(e){"use strict";var t;return 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}."}(t||(t={})),function(n){return(...s)=>(e.invariant(e.isFunction(n),t.PROMISIFY_REQUIRE_FUNCTION),new Promise((e=>n(...s).done(e))))}}));