vest 3.3.0-dev-549cb1 → 4.0.0-dev-deabb8

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.0-dev-549cb1",
2
+ "version": "4.0.0-dev-deabb8",
3
3
  "license": "MIT",
4
4
  "name": "vest",
5
5
  "author": "ealush",
@@ -14,84 +14,84 @@
14
14
  "exports": {
15
15
  "./classnames": {
16
16
  "production": {
17
- "browser": "../dist/es/classnames.production.js",
18
- "umd": "../dist/umd/classnames.production.js",
19
- "import": "../dist/es/classnames.production.js",
20
- "require": "../dist/cjs/classnames.production.js",
21
- "node": "../dist/cjs/classnames.production.js",
22
- "module": "../dist/es/classnames.production.js",
23
- "default": "../dist/cjs/classnames.production.js"
17
+ "browser": "./dist/es/classnames.production.js",
18
+ "umd": "./dist/umd/classnames.production.js",
19
+ "import": "./dist/es/classnames.production.js",
20
+ "require": "./dist/cjs/classnames.production.js",
21
+ "node": "./dist/cjs/classnames.production.js",
22
+ "module": "./dist/es/classnames.production.js",
23
+ "default": "./dist/cjs/classnames.production.js"
24
24
  },
25
25
  "development": {
26
- "browser": "../dist/es/classnames.development.js",
27
- "umd": "../dist/umd/classnames.development.js",
28
- "import": "../dist/es/classnames.development.js",
29
- "require": "../dist/cjs/classnames.development.js",
30
- "node": "../dist/cjs/classnames.development.js",
31
- "module": "../dist/es/classnames.development.js",
32
- "default": "../dist/cjs/classnames.development.js"
26
+ "browser": "./dist/es/classnames.development.js",
27
+ "umd": "./dist/umd/classnames.development.js",
28
+ "import": "./dist/es/classnames.development.js",
29
+ "require": "./dist/cjs/classnames.development.js",
30
+ "node": "./dist/cjs/classnames.development.js",
31
+ "module": "./dist/es/classnames.development.js",
32
+ "default": "./dist/cjs/classnames.development.js"
33
33
  },
34
- "browser": "../dist/es/classnames.production.js",
35
- "umd": "../dist/umd/classnames.production.js",
36
- "import": "../dist/es/classnames.production.js",
37
- "require": "../dist/cjs/classnames.js",
38
- "node": "../dist/cjs/classnames.js",
39
- "module": "../dist/es/classnames.production.js",
40
- "default": "../dist/cjs/classnames.js"
34
+ "browser": "./dist/es/classnames.production.js",
35
+ "umd": "./dist/umd/classnames.production.js",
36
+ "import": "./dist/es/classnames.production.js",
37
+ "require": "./dist/cjs/classnames.js",
38
+ "node": "./dist/cjs/classnames.js",
39
+ "module": "./dist/es/classnames.production.js",
40
+ "default": "./dist/cjs/classnames.js"
41
41
  },
42
42
  "./parser": {
43
43
  "production": {
44
- "browser": "../dist/es/parser.production.js",
45
- "umd": "../dist/umd/parser.production.js",
46
- "import": "../dist/es/parser.production.js",
47
- "require": "../dist/cjs/parser.production.js",
48
- "node": "../dist/cjs/parser.production.js",
49
- "module": "../dist/es/parser.production.js",
50
- "default": "../dist/cjs/parser.production.js"
44
+ "browser": "./dist/es/parser.production.js",
45
+ "umd": "./dist/umd/parser.production.js",
46
+ "import": "./dist/es/parser.production.js",
47
+ "require": "./dist/cjs/parser.production.js",
48
+ "node": "./dist/cjs/parser.production.js",
49
+ "module": "./dist/es/parser.production.js",
50
+ "default": "./dist/cjs/parser.production.js"
51
51
  },
52
52
  "development": {
53
- "browser": "../dist/es/parser.development.js",
54
- "umd": "../dist/umd/parser.development.js",
55
- "import": "../dist/es/parser.development.js",
56
- "require": "../dist/cjs/parser.development.js",
57
- "node": "../dist/cjs/parser.development.js",
58
- "module": "../dist/es/parser.development.js",
59
- "default": "../dist/cjs/parser.development.js"
53
+ "browser": "./dist/es/parser.development.js",
54
+ "umd": "./dist/umd/parser.development.js",
55
+ "import": "./dist/es/parser.development.js",
56
+ "require": "./dist/cjs/parser.development.js",
57
+ "node": "./dist/cjs/parser.development.js",
58
+ "module": "./dist/es/parser.development.js",
59
+ "default": "./dist/cjs/parser.development.js"
60
60
  },
61
- "browser": "../dist/es/parser.production.js",
62
- "umd": "../dist/umd/parser.production.js",
63
- "import": "../dist/es/parser.production.js",
64
- "require": "../dist/cjs/parser.js",
65
- "node": "../dist/cjs/parser.js",
66
- "module": "../dist/es/parser.production.js",
67
- "default": "../dist/cjs/parser.js"
61
+ "browser": "./dist/es/parser.production.js",
62
+ "umd": "./dist/umd/parser.production.js",
63
+ "import": "./dist/es/parser.production.js",
64
+ "require": "./dist/cjs/parser.js",
65
+ "node": "./dist/cjs/parser.js",
66
+ "module": "./dist/es/parser.production.js",
67
+ "default": "./dist/cjs/parser.js"
68
68
  },
69
69
  "./promisify": {
70
70
  "production": {
71
- "browser": "../dist/es/promisify.production.js",
72
- "umd": "../dist/umd/promisify.production.js",
73
- "import": "../dist/es/promisify.production.js",
74
- "require": "../dist/cjs/promisify.production.js",
75
- "node": "../dist/cjs/promisify.production.js",
76
- "module": "../dist/es/promisify.production.js",
77
- "default": "../dist/cjs/promisify.production.js"
71
+ "browser": "./dist/es/promisify.production.js",
72
+ "umd": "./dist/umd/promisify.production.js",
73
+ "import": "./dist/es/promisify.production.js",
74
+ "require": "./dist/cjs/promisify.production.js",
75
+ "node": "./dist/cjs/promisify.production.js",
76
+ "module": "./dist/es/promisify.production.js",
77
+ "default": "./dist/cjs/promisify.production.js"
78
78
  },
79
79
  "development": {
80
- "browser": "../dist/es/promisify.development.js",
81
- "umd": "../dist/umd/promisify.development.js",
82
- "import": "../dist/es/promisify.development.js",
83
- "require": "../dist/cjs/promisify.development.js",
84
- "node": "../dist/cjs/promisify.development.js",
85
- "module": "../dist/es/promisify.development.js",
86
- "default": "../dist/cjs/promisify.development.js"
80
+ "browser": "./dist/es/promisify.development.js",
81
+ "umd": "./dist/umd/promisify.development.js",
82
+ "import": "./dist/es/promisify.development.js",
83
+ "require": "./dist/cjs/promisify.development.js",
84
+ "node": "./dist/cjs/promisify.development.js",
85
+ "module": "./dist/es/promisify.development.js",
86
+ "default": "./dist/cjs/promisify.development.js"
87
87
  },
88
- "browser": "../dist/es/promisify.production.js",
89
- "umd": "../dist/umd/promisify.production.js",
90
- "import": "../dist/es/promisify.production.js",
91
- "require": "../dist/cjs/promisify.js",
92
- "node": "../dist/cjs/promisify.js",
93
- "module": "../dist/es/promisify.production.js",
94
- "default": "../dist/cjs/promisify.js"
88
+ "browser": "./dist/es/promisify.production.js",
89
+ "umd": "./dist/umd/promisify.production.js",
90
+ "import": "./dist/es/promisify.production.js",
91
+ "require": "./dist/cjs/promisify.js",
92
+ "node": "./dist/cjs/promisify.js",
93
+ "module": "./dist/es/promisify.production.js",
94
+ "default": "./dist/cjs/promisify.js"
95
95
  },
96
96
  ".": {
97
97
  "browser": "./dist/es/vest.production.js",
@@ -104,5 +104,14 @@
104
104
  },
105
105
  "./package.json": "./package.json",
106
106
  "./": "./"
107
- }
107
+ },
108
+ "repository": {
109
+ "type": "git",
110
+ "url": "https://github.com/ealush/vest.git",
111
+ "directory": "packages/vest"
112
+ },
113
+ "bugs": {
114
+ "url": "https://github.com/ealush/vest.git/issues"
115
+ },
116
+ "homepage": "https://vestjs.dev/"
108
117
  }
@@ -3,6 +3,7 @@ import optionalFunctionValue from 'optionalFunctionValue';
3
3
  import runCreateRef from './runCreateRef';
4
4
 
5
5
  import context from 'ctx';
6
+ import { initBus } from 'vestBus';
6
7
 
7
8
  export default function itWithContext(
8
9
  str: string,
@@ -11,7 +12,10 @@ export default function itWithContext(
11
12
  ): void {
12
13
  return it(str, () =>
13
14
  context.run(
14
- optionalFunctionValue(getCTX) ?? { stateRef: runCreateRef() },
15
+ optionalFunctionValue(getCTX) ?? {
16
+ stateRef: runCreateRef(),
17
+ bus: initBus(),
18
+ },
15
19
  cb
16
20
  )
17
21
  );
@@ -1,4 +1,4 @@
1
- import createState from 'vast';
1
+ import { createState } from 'vast';
2
2
 
3
3
  import createStateRef from 'createStateRef';
4
4
 
package/types/vest.d.ts CHANGED
@@ -18,6 +18,7 @@ type TRuleDetailedResult = {
18
18
  };
19
19
  type TLazyRules = TRules<TLazyRuleMethods>;
20
20
  type TLazy = TLazyRules & TLazyRuleMethods;
21
+ type TShapeObject = Record<any, TLazy>;
21
22
  type TLazyRuleMethods = TLazyRuleRunners & {
22
23
  message: (message: TLazyMessage) => TLazy;
23
24
  };
@@ -46,6 +47,7 @@ type TRuleBase = (value: TRuleValue, ...args: TArgs) => TRuleReturn;
46
47
  type TRule = Record<string, TRuleBase>;
47
48
  type TBaseRules = typeof baseRules;
48
49
  type KBaseRules = keyof TBaseRules;
50
+ declare function condition(value: any, callback: (value: any) => TRuleReturn): TRuleReturn;
49
51
  declare function endsWith(value: string, arg1: string): boolean;
50
52
  declare function equals(value: unknown, arg1: unknown): boolean;
51
53
  declare function greaterThan(value: number | string, gt: number | string): boolean;
@@ -56,12 +58,14 @@ declare function inside(value: unknown, arg1: string | unknown[]): boolean;
56
58
  // We may need to revisit this in the future.
57
59
  declare function isArray(value: unknown): value is Array<unknown>;
58
60
  declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
61
+ declare function isBoolean(value: unknown): value is boolean;
59
62
  declare function isEmpty(value: unknown): boolean;
60
63
  declare function isNaN(value: unknown): boolean;
61
64
  declare function isNegative(value: number | string): boolean;
62
65
  declare function isNull(value: unknown): value is null;
63
66
  declare function isNumber(value: unknown): value is number;
64
67
  declare function isNumeric(value: string | number): boolean;
68
+ declare function isStringValue(v: unknown): v is string;
65
69
  declare function isTruthy(value: unknown): boolean;
66
70
  declare function isUndefined(value?: unknown): boolean;
67
71
  declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
@@ -74,8 +78,11 @@ declare function numberEquals(value: string | number, eq: string | number): bool
74
78
  declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
75
79
  declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
76
80
  declare function startsWith(value: string, arg1: string): boolean;
81
+ declare function shape(inputObject: Record<string, any>, shapeObject: TShapeObject): TRuleDetailedResult;
82
+ declare function loose(inputObject: Record<string, any>, shapeObject: TShapeObject): TRuleDetailedResult;
83
+ declare function isArrayOf(inputArray: any[], currentRule: TLazy): TRuleDetailedResult;
77
84
  declare const baseRules: {
78
- condition: typeof default;
85
+ condition: typeof condition;
79
86
  doesNotEndWith: (value: string, arg1: string) => boolean;
80
87
  doesNotStartWith: (value: string, arg1: string) => boolean;
81
88
  endsWith: typeof endsWith;
@@ -87,7 +94,7 @@ declare const baseRules: {
87
94
  inside: typeof inside;
88
95
  isArray: typeof isArray;
89
96
  isBetween: typeof isBetween;
90
- isBoolean: typeof default;
97
+ isBoolean: typeof isBoolean;
91
98
  isEmpty: typeof isEmpty;
92
99
  isEven: (value: any) => boolean;
93
100
  isFalsy: (value: unknown) => boolean;
@@ -108,7 +115,7 @@ declare const baseRules: {
108
115
  isNumeric: typeof isNumeric;
109
116
  isOdd: (value: any) => boolean;
110
117
  isPositive: (value: string | number) => boolean;
111
- isString: typeof default;
118
+ isString: typeof isStringValue;
112
119
  isTruthy: typeof isTruthy;
113
120
  isUndefined: typeof isUndefined;
114
121
  lengthEquals: typeof lengthEquals;
@@ -129,15 +136,15 @@ declare const baseRules: {
129
136
  shorterThanOrEquals: typeof shorterThanOrEquals;
130
137
  startsWith: typeof startsWith;
131
138
  } & {
132
- allOf: typeof default;
133
- anyOf: typeof default;
134
- noneOf: typeof default;
135
- oneOf: typeof default;
136
- optional: typeof default;
139
+ allOf: typeof allOf;
140
+ anyOf: typeof anyOf;
141
+ noneOf: typeof noneOf;
142
+ oneOf: typeof oneOf;
143
+ optional: typeof optional;
137
144
  } & {
138
- shape: typeof default;
139
- loose: typeof default;
140
- isArrayOf: typeof default;
145
+ shape: typeof shape;
146
+ loose: typeof loose;
147
+ isArrayOf: typeof isArrayOf;
141
148
  };
142
149
  type TRules<E = Record<string, unknown>> = Record<string, (...args: TArgs) => TRules & E> & {
143
150
  [P in KCompounds]: (...args: DropFirst<Parameters<TCompounds[P]>> | TArgs) => TRules & E;
@@ -223,7 +230,6 @@ declare function create<T extends (...args: any[]) => void>(suiteCallback: T): {
223
230
  get: () => TDraftResult;
224
231
  reset: () => void;
225
232
  remove: (fieldName: string) => void;
226
- subscribe: (handler: () => void) => void;
227
233
  };
228
234
  declare class VestTest {
229
235
  fieldName: string;
@@ -250,6 +256,7 @@ declare class VestTest {
250
256
  hasFailures(): boolean;
251
257
  isPending(): boolean;
252
258
  isTested(): boolean;
259
+ isUntested(): boolean;
253
260
  isFailing(): boolean;
254
261
  isCanceled(): boolean;
255
262
  isSkipped(): boolean;
@@ -283,7 +290,7 @@ declare function skipWhen(conditional: boolean | ((...args: any[]) => boolean),
283
290
  /**
284
291
  * Runs a group callback.
285
292
  */
286
- declare function group(groupName: string, tests: () => any): void;
293
+ declare function group(groupName: string, tests: () => void): void;
287
294
  declare function optional$0(optionals: string | string[]): void;
288
295
  declare function testBase(fieldName: string, ...args: [
289
296
  message: string,
@@ -303,5 +310,5 @@ declare const _default: typeof testBase & {
303
310
  };
304
311
  };
305
312
  declare const test: typeof _default;
306
- declare const VERSION = "3.3.0-dev-549cb1";
313
+ declare const VERSION = "4.0.0-dev-deabb8";
307
314
  export { test, create, only, skip, warn, group, optional$0 as optional, skipWhen, enforce, VERSION };