Skip to content

Commit

Permalink
3.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin McDonnell committed Sep 25, 2021
1 parent af57098 commit 6aef508
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions deno/lib/__tests__/error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,19 @@ test("invalid and required and errorMap", () => {
});
}).toThrow();
});

test("dont short circuit on continuable errors", () => {
const user = z
.object({
password: z.string().min(6),
confirm: z.string(),
})
.refine((data) => data.password === data.confirm, {
message: "Passwords don't match",
path: ["confirm"],
});
const result = user.safeParse({ password: "asdf", confirm: "qwer" });
if (!result.success) {
expect(result.error.issues.length).toEqual(2);
}
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zod",
"version": "3.9.0",
"version": "3.9.1",
"description": "TypeScript-first schema declaration and validation library with static type inference",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
16 changes: 16 additions & 0 deletions src/__tests__/error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,19 @@ test("invalid and required and errorMap", () => {
});
}).toThrow();
});

test("dont short circuit on continuable errors", () => {
const user = z
.object({
password: z.string().min(6),
confirm: z.string(),
})
.refine((data) => data.password === data.confirm, {
message: "Passwords don't match",
path: ["confirm"],
});
const result = user.safeParse({ password: "asdf", confirm: "qwer" });
if (!result.success) {
expect(result.error.issues.length).toEqual(2);
}
});

0 comments on commit 6aef508

Please sign in to comment.