Skip to content

Commit 6aef508

Browse files
author
Colin McDonnell
committed
3.9.1
1 parent af57098 commit 6aef508

4 files changed

Lines changed: 34 additions & 2 deletions

File tree

coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

deno/lib/__tests__/error.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,19 @@ test("invalid and required and errorMap", () => {
367367
});
368368
}).toThrow();
369369
});
370+
371+
test("dont short circuit on continuable errors", () => {
372+
const user = z
373+
.object({
374+
password: z.string().min(6),
375+
confirm: z.string(),
376+
})
377+
.refine((data) => data.password === data.confirm, {
378+
message: "Passwords don't match",
379+
path: ["confirm"],
380+
});
381+
const result = user.safeParse({ password: "asdf", confirm: "qwer" });
382+
if (!result.success) {
383+
expect(result.error.issues.length).toEqual(2);
384+
}
385+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod",
3-
"version": "3.9.0",
3+
"version": "3.9.1",
44
"description": "TypeScript-first schema declaration and validation library with static type inference",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",

src/__tests__/error.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,19 @@ test("invalid and required and errorMap", () => {
366366
});
367367
}).toThrow();
368368
});
369+
370+
test("dont short circuit on continuable errors", () => {
371+
const user = z
372+
.object({
373+
password: z.string().min(6),
374+
confirm: z.string(),
375+
})
376+
.refine((data) => data.password === data.confirm, {
377+
message: "Passwords don't match",
378+
path: ["confirm"],
379+
});
380+
const result = user.safeParse({ password: "asdf", confirm: "qwer" });
381+
if (!result.success) {
382+
expect(result.error.issues.length).toEqual(2);
383+
}
384+
});

0 commit comments

Comments
 (0)