vest 4.0.0-dev-deabb8 → 4.0.0-dev-8851ff

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/CHANGELOG.md CHANGED
@@ -4,60 +4,72 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## 4.0.0 - 2021-10-02
7
+ ## 4.0.0 - 2021-10-25
8
8
  ### Changed or removed
9
- - 0e3af10 major(context): used named export in context (ealush)
10
- - 1897164 major(vest, enforce): setup next major version (ealush)
11
- - bf9265e breaking(vest, enforce): prepare next major (ealush)
9
+ - f5ba507 major(context): used named export in context (ealush)
10
+ - eaed68f breaking(vest, enforce): prepare next major (ealush)
12
11
 
13
12
  ### Added
14
- - b0cbb32 feat(vest): Add a parser export (ealush)
15
- - fc75f1d feat(vest): isValid with field name (ealush)
16
- - c427e4e feat(vest): handle execution order state refill with memoized tests (ealush)
17
- - 443c275 feat(vest): Make the state rely on execution order. Add skipWhen. (undefined)
18
- - 2988655 added(n4s): partial rule modifier (undefined)
19
- - f41a444 feat(n4s): context propagation within enforce (undefined)
13
+ - e0f0f91 feat(vest): support custom optional logic (ealush)
14
+ - d4fecee feat(vest): Add a parser export (ealush)
15
+ - e72498d feat(vest): isValid with field name (ealush)
16
+ - f60d952 feat(vest): handle execution order state refill with memoized tests (ealush)
17
+ - a2b60c4 feat(vest): Make the state rely on execution order. Make skipWhen set skipped context. (undefined)
18
+ - ae5eb02 added(n4s): partial rule modifier (undefined)
19
+ - 990c68f feat(n4s): context propagation within enforce (undefined)
20
20
 
21
21
  ### Fixed and improved
22
- - deabb8e patch(vest): add cache invalidation for canceled tests (ealush)
23
- - fd1e31e types(vest): add safeguard around shouldUseErrorAsMessage (ealush)
24
- - 8321a36 patch(vest): some cleanups (ealush)
25
- - 8320956 patch(vest): remove duplicate code handling perv test registration (ealush)
26
- - 7e3fffb vx: use context directly from published package (ealush)
27
- - ac45a64 patch: run done callbacks via event (ealush)
28
- - e0f05d6 patch(vest): removed state subscription (ealush)
22
+ - 8851ff5 patch(vest): Add isolate module for containing re-orders (ealush)
23
+ - 0593c0f patch(vest): refresh tests after cancel (ealush)
24
+ - e915b53 patch: add cursor util (ealush)
25
+ - f54ae8b patch(vest): move cursor into context (ealush)
26
+ - fc7627e patch(vest): automatically purge not-found test results (ealush)
27
+ - d68d990 vx: correctly pass cli options to build script (ealush)
28
+ - 7c47b9a patch(vest): Throw error when tests are called in the wrong order (ealush)
29
+ - 01be84e vx: add types to exports (ealush)
30
+ - 7201170 organize vest state hooks (ealush)
31
+ - e39bfd8 patch(vest): infer omitted optional fields (ealush)
32
+ - 93014e3 vx: add dev bundle to exports (ealush)
33
+ - 91df42e fix(vest): prevent changing test status once it was finalized (ealush)
34
+ - 797df3e patch(vest): add cache invalidation for canceled tests (ealush)
35
+ - 14ba6d9 types(vest): add safeguard around shouldUseErrorAsMessage (ealush)
36
+ - 477ca00 patch(vest): some cleanups (ealush)
37
+ - 58d5ed3 patch(vest): remove duplicate code handling perv test registration (ealush)
38
+ - 6a98443 vx: use context directly from published package (ealush)
39
+ - a79e479 patch: run done callbacks via event (ealush)
40
+ - 01d32b7 patch(vest): removed state subscription (ealush)
29
41
  - package.json
30
42
  - packages/anyone/package.json
31
43
  - packages/anyone/package.json
32
44
  - packages/vast/types/vast.d.ts
33
- - 2515275 patch(vest): remove pending and lagging state (ealush)
34
- - 4c38835 patch(vest): convert boolean flags to a single status key (ealush)
35
- - e24f0bd patch: simplify fieldname comparison (ealush)
36
- - b927b5c patch(vest): add useAllIncomplete hook (ealush)
37
- - a88dd38 patch(vest): invalid accounts for warning tests as well (ealush)
38
- - eaf9bef patch(vest): isValid counts all required tests per field (ealush)
39
- - 7a4ba03 chore: cleanups (ealush)
45
+ - b10b98b patch(vest): remove pending and lagging state (ealush)
46
+ - dfd2cc3 patch(vest): convert boolean flags to a single status key (ealush)
47
+ - 1c9da6c patch: simplify fieldname comparison (ealush)
48
+ - 43c75a4 patch(vest): add useAllIncomplete hook (ealush)
49
+ - 2dfdc97 patch(vest): invalid accounts for warning tests as well (ealush)
50
+ - 4033cca patch(vest): isValid counts all required tests per field (ealush)
51
+ - 02b28a6 chore: cleanups (ealush)
40
52
  - .eslintrc.js
41
- - 1878ffc add(n4s): enforce.condition (ealush)
53
+ - afa16e9 add(n4s): enforce.condition (ealush)
42
54
  - package.json
43
55
  - packages/anyone/package.json
44
- - a89af46 chore: cleanup residue (undefined)
45
- - be86496 chore: remove duplicate types (undefined)
56
+ - d452e26 chore: cleanup residue (undefined)
57
+ - 5982183 chore: remove duplicate types (undefined)
46
58
  - packages/anyone/package.json
47
- - 44de93f patch: add nodejs exports (undefined)
48
- - abb0efe patch: remove unused exports (undefined)
59
+ - 52ac8e0 patch: add nodejs exports (undefined)
60
+ - f9c4b3e patch: remove unused exports (undefined)
49
61
  - packages/anyone/package.json
50
- - a8540de chore: reduce complexity, remove all lint errors (undefined)
62
+ - db0253b chore: reduce complexity, remove all lint errors (undefined)
51
63
  - packages/anyone/.npmignore
52
64
  - .github/PULL_REQUEST_TEMPLATE.md
53
- - f58327f chore: cleanup unused code (ealush)
54
- - 853cee6 lint: handling lint of all packages (ealush)
65
+ - be9c776 chore: cleanup unused code (ealush)
66
+ - c5eb2de lint: handling lint of all packages (ealush)
55
67
  - .gitignore
56
- - d148f6d patch(n4s): add ruleReturn default values (ealush)
57
- - c722fbd fix(n4s): make enforce compound runners fall back to correct response (ealush)
58
- - fa65911 fix(n4s): make enforce chaining work (ealush)
59
- - a2437a3 chore: some lint fixes (ealush)
60
- - aabb5f4 add cli options support (ealush)
68
+ - d388fdc patch(n4s): add ruleReturn default values (ealush)
69
+ - be91b7e fix(n4s): make enforce compound runners fall back to correct response (ealush)
70
+ - 7e8f25c fix(n4s): make enforce chaining work (ealush)
71
+ - e60ce3b chore: some lint fixes (ealush)
72
+ - fc8e2d8 add cli options support (ealush)
61
73
 
62
74
  ## 3.2.7 - 2021-07-17
63
75
 
package/README.md CHANGED
@@ -0,0 +1,113 @@
1
+ ![Vest](https://cdn.jsdelivr.net/gh/ealush/vest@assets/vest-logo.png 'Vest')
2
+
3
+ # Vest 🦺 Declarative Validation Testing
4
+
5
+ ![Github Stars](https://githubbadges.com/star.svg?user=ealush&repo=vest&style=flat)
6
+ ![Npm downloads](https://img.shields.io/npm/dt/vest?label=Downloads&logo=npm)
7
+
8
+ [![npm version](https://badge.fury.io/js/vest.svg)](https://badge.fury.io/js/vest) [![Build Status](https://travis-ci.org/ealush/vest.svg?branch=latest)](https://travis-ci.org/ealush/vest) [![Known Vulnerabilities](https://snyk.io/test/npm/vest/badge.svg)](https://snyk.io/test/npm/vest)
9
+ ![minifiedSize](https://img.shields.io/bundlephobia/min/vest?color=blue&logo=npm)
10
+
11
+ [![Join discord](https://img.shields.io/discord/757686103292641312?label=Join%20Discord&logo=discord&logoColor=green)](https://discord.gg/WmADZpJnSe)
12
+
13
+ - [Documentation homepage](https://vestjs.dev)
14
+ - **Try vest live**
15
+ - [Vanilla JS Example](https://stackblitz.com/edit/vest-vanilla-support-example?file=validation.js)
16
+ - ReactJS Examples:
17
+ - [Example 1 (groups)](https://codesandbox.io/s/ecstatic-waterfall-4i2ne?file=/src/validate.js)
18
+ - [Example 2 (Async)](https://codesandbox.io/s/youthful-williamson-loijb?file=/src/validate.js)
19
+ - [Example 3](https://stackblitz.com/edit/vest-react-support-example?file=validation.js)
20
+ - [Example 4](https://stackblitz.com/edit/vest-react-registration?file=validate.js)
21
+ - [Example 5 (Password validator)](https://codesandbox.io/s/password-validator-example-6puvy?file=/src/validate.js)
22
+ - [VueJS Example](https://codesandbox.io/s/vest-vue-example-1j6r8?file=/src/validations.js)
23
+ - [Svelte Example](https://codesandbox.io/s/vestdocssvelteexample-k87t7?file=/validate.js)
24
+
25
+ ## Tutorials
26
+
27
+ [Step By Step React Tutorial](https://dev.to/ealush/dead-simple-form-validation-with-vest-5gf8)
28
+
29
+ ## [Release Notes](https://github.com/ealush/vest/releases)
30
+
31
+ ## 🦺 What is Vest?
32
+
33
+ Vest is a validations library for JS apps that derives its syntax from modern JS unit testing frameworks such as Mocha or Jest. It is easy to learn due to its use of already common declarative patterns.
34
+ It works great with user-input validation and with validating upon user interaction to provide the best possible user experience.
35
+
36
+ The idea behind Vest is that your validations can be described as a 'spec' or a contract that reflects your form or feature structure. Your validations run in production, and they are framework agnostic - meaning Vest works well with React, Angular, Vue, or even without a framework at all.
37
+
38
+ Using Vest for form validation can reduce bloat, improve feature readability and maintainability.
39
+
40
+ **Basic Example**
41
+ ![full](https://cdn.jsdelivr.net/gh/ealush/vest@assets/demos/full_3.gif 'full')
42
+
43
+ **Memoized async test**
44
+ ![memo](https://cdn.jsdelivr.net/gh/ealush/vest@assets/demos/memo.gif 'memo')
45
+
46
+ ## ✅ Motivation
47
+
48
+ Writing forms is an integral part of building web apps, and even though it may seem trivial at first - as your feature grows over time, so does your validation logic grows in complexity.
49
+
50
+ Vest tries to remediate this by separating validation logic from feature logic so it is easier to maintain over time and refactor when needed.
51
+
52
+ ## ✨ Vest's features
53
+
54
+ - 🎨 Framework agnostic (BYOUI)
55
+ - ⚡️ Rich, extendable, assertions library (enforce) ([doc](http://vestjs.dev/#/enforce))
56
+ - 🚥 Multiple validations for the same field
57
+ - ⚠️ Warning (non failing) tests ([doc](http://vestjs.dev/#/warn))
58
+ - 📝 Validate only the fields the user interacted with ([doc](http://vestjs.dev/#/exclusion))
59
+ - ⏳ Memoize async validations to reduce calls to the server ([doc](http://vestjs.dev/#/test?id=testmemo-for-memoized-tests))
60
+ - 🚦 Test grouping ([doc](http://vestjs.dev/#/group))
61
+
62
+ ## Example code ([Run in sandbox](https://codesandbox.io/s/vest-react-tutorial-finished-ztt8t?file=/src/validate.js))
63
+
64
+ ```js
65
+ import { create, only, test, enforce, warn, skipWhen } from 'vest';
66
+
67
+ export default create((data = {}, currentField) => {
68
+ only(currentField);
69
+
70
+ test('username', 'Username is required', () => {
71
+ enforce(data.username).isNotEmpty();
72
+ });
73
+
74
+ test('username', 'Username is too short', () => {
75
+ enforce(data.username).longerThanOrEquals(3);
76
+ });
77
+
78
+ test('password', 'Password is required', () => {
79
+ enforce(data.password).isNotEmpty();
80
+ });
81
+
82
+ test('password', 'Password must be at least 6 chars long', () => {
83
+ enforce(data.password).longerThanOrEquals(6);
84
+ });
85
+
86
+ test('password', 'Password is weak, Maybe add a number?', () => {
87
+ warn();
88
+ enforce(data.password).matches(/[0-9]/);
89
+ });
90
+
91
+ skipWhen(!data.password, () => {
92
+ test('confirm_password', 'Passwords do not match', () => {
93
+ enforce(data.confirm_password).equals(data.password);
94
+ });
95
+ });
96
+
97
+ test('email', 'Email Address is not valid', () => {
98
+ enforce(data.email).isEmail();
99
+ });
100
+
101
+ test('tos', () => {
102
+ enforce(data.tos).isTruthy();
103
+ });
104
+ });
105
+ ```
106
+
107
+ ## Why Vest?
108
+
109
+ - 🧠 Vest is really easy to learn. You can take your existing knowledge of unit tests and transfer it to validations.
110
+ - ✏️ Vest takes into account user interaction and warn only validations.
111
+ - 🧱 Your validations are structured, making it very simple to read and write. All validation files look the same.
112
+ - 🖇 Your validation logic is separate from your feature logic, preventing the spaghetti code that's usually involved with writing validations.
113
+ - 🧩 Validation logic is easy to share and reuse across features.