vest 5.0.0-dev-781e21 → 5.0.0-dev-ec989a

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 (71) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +2 -57
  3. package/dist/cjs/classnames.development.js +37 -17
  4. package/dist/cjs/classnames.production.js +1 -1
  5. package/dist/cjs/enforce/compose.development.js +1 -54
  6. package/dist/cjs/enforce/compose.production.js +1 -1
  7. package/dist/cjs/enforce/compounds.development.js +18 -84
  8. package/dist/cjs/enforce/compounds.production.js +1 -1
  9. package/dist/cjs/enforce/schema.development.js +18 -84
  10. package/dist/cjs/enforce/schema.production.js +1 -1
  11. package/dist/cjs/parser.development.js +30 -11
  12. package/dist/cjs/parser.production.js +1 -1
  13. package/dist/cjs/promisify.development.js +21 -9
  14. package/dist/cjs/promisify.production.js +1 -1
  15. package/dist/cjs/vest.development.js +1324 -1294
  16. package/dist/cjs/vest.production.js +1 -1
  17. package/dist/es/classnames.development.js +39 -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 +31 -10
  26. package/dist/es/parser.production.js +1 -1
  27. package/dist/es/promisify.development.js +22 -10
  28. package/dist/es/promisify.production.js +1 -1
  29. package/dist/es/vest.development.js +1321 -1286
  30. package/dist/es/vest.production.js +1 -1
  31. package/dist/umd/classnames.development.js +40 -20
  32. package/dist/umd/classnames.production.js +1 -1
  33. package/dist/umd/enforce/compose.development.js +6 -60
  34. package/dist/umd/enforce/compose.production.js +1 -1
  35. package/dist/umd/enforce/compounds.development.js +29 -94
  36. package/dist/umd/enforce/compounds.production.js +1 -1
  37. package/dist/umd/enforce/schema.development.js +29 -94
  38. package/dist/umd/enforce/schema.production.js +1 -1
  39. package/dist/umd/parser.development.js +33 -14
  40. package/dist/umd/parser.production.js +1 -1
  41. package/dist/umd/promisify.development.js +24 -12
  42. package/dist/umd/promisify.production.js +1 -1
  43. package/dist/umd/vest.development.js +1327 -1298
  44. package/dist/umd/vest.production.js +1 -1
  45. package/package.json +144 -147
  46. package/testUtils/TVestMock.ts +7 -0
  47. package/testUtils/__tests__/partition.test.ts +4 -4
  48. package/testUtils/asVestTest.ts +9 -0
  49. package/testUtils/mockThrowError.ts +4 -2
  50. package/testUtils/suiteDummy.ts +4 -1
  51. package/testUtils/testDummy.ts +12 -10
  52. package/testUtils/testPromise.ts +3 -0
  53. package/types/classnames.d.ts +141 -12
  54. package/types/classnames.d.ts.map +1 -0
  55. package/types/enforce/compose.d.ts +2 -126
  56. package/types/enforce/compose.d.ts.map +1 -0
  57. package/types/enforce/compounds.d.ts +2 -136
  58. package/types/enforce/compounds.d.ts.map +1 -0
  59. package/types/enforce/schema.d.ts +2 -144
  60. package/types/enforce/schema.d.ts.map +1 -0
  61. package/types/parser.d.ts +147 -18
  62. package/types/parser.d.ts.map +1 -0
  63. package/types/promisify.d.ts +139 -43
  64. package/types/promisify.d.ts.map +1 -0
  65. package/types/vest.d.ts +257 -242
  66. package/types/vest.d.ts.map +1 -0
  67. package/CHANGELOG.md +0 -87
  68. package/testUtils/expandStateRef.ts +0 -8
  69. package/testUtils/runCreateRef.ts +0 -10
  70. package/testUtils/testObjects.ts +0 -6
  71. package/tsconfig.json +0 -8
@@ -1,20 +1,32 @@
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["PROMISIFY_REQUIRE_FUNCTION"] = "Vest.Promisify must be called with a function";
14
+ ErrorStrings["PARSER_EXPECT_RESULT_OBJECT"] = "Vest parser: expected argument at position 0 to be Vest's result object.";
15
+ ErrorStrings["WARN_MUST_BE_CALLED_FROM_TEST"] = "Warn must be called from within the body of a test function";
16
+ ErrorStrings["EACH_CALLBACK_MUST_BE_A_FUNCTION"] = "Each must be called with a function";
17
+ ErrorStrings["INVALID_PARAM_PASSED_TO_FUNCTION"] = "Incompatible params passed to {fn_name} function. \"{param}\" must be of type {expected}";
18
+ 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.";
19
+ 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}.";
20
+ ErrorStrings["UNEXPECTED_TEST_RUN_ERROR"] = "Unexpected error encountered during test run. Please report this issue to Vest's Github repository.\n Test Object: {testObject}.";
21
+ })(ErrorStrings || (ErrorStrings = {}));
22
+
23
+ function promisify(validatorFn) {
24
+ return (...args) => {
25
+ vestUtils.invariant(vestUtils.isFunction(validatorFn), ErrorStrings.PROMISIFY_REQUIRE_FUNCTION);
26
+ return new Promise(resolve => validatorFn(...args).done(resolve));
15
27
  };
16
- };
28
+ }
17
29
 
18
30
  return promisify;
19
31
 
20
- })));
32
+ }));
@@ -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.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}."}(t||(t={})),function(n){return(...s)=>(e.invariant(e.isFunction(n),t.PROMISIFY_REQUIRE_FUNCTION),new Promise((e=>n(...s).done(e))))}}));