mirror of
https://github.com/hanzoai/zod.git
synced 2026-09-24 17:04:49 +00:00
* Add continuability tests * Update docs for custom string formats (#4868) * docs: add stringFormat examples * Improve * Improve regex * Improve regex * Add console output guard (#4869) * test: fail on console output * Fmt * feat(object): add safeExtend (#4865) * `z.hash()` (#5049) * Implement z.hash() * Implement tests * Document z.hash * Update packages/zod/src/v4/core/regexes.ts * Throw on unrecognized --------- * Drop JIT in Zod Mini `z.object()` (reduces bundle size by 20%) (#5051) * WIP * WIP * No comments * feat: add openapi target to json schema (#5052) * Implement `z.codec` (#5113) * WIP * WIP * WIP * Fix pipe * Add mini codec tests * Fix test * WIP * Add codecs graphic * Add reverse tests for pipe * WIP * More fixes * Remove logs * WIP * Make `z.function()` extend $ZodType (#5121) * WIP * Add back function schemas * Drop unneeded import * Implement z.hex() (#5122) * Document codec examples (#5123) * Document codec examples * Avoid zodtypeany * Tweaks * Improve docs * Improve docs * Tweak * Tweak * Update json codec * Update disc union docs. Closes #5108 * Add .options to ZodMiniEnum. Closes #5116 * Implement two-phase parsing for codecs * Add mutating test * Improve when docs * Support the Max UUID in z.uuid(). Closes #5127 * Make z.hash format properly inferred * Update snapshots with new uuid regex * Add hex,hash to docs. * Throw on .extend() when refinements are present. Document safeExtend() * Update safeExtend docs * Update meta docs * Update packages/docs/content/api.mdx Co-authored-by: Sam Chung <[email protected]> * Add section for customizing z.coerce inputs * Tweak * Docs tweak --------- Co-authored-by: Sam Chung <[email protected]> Co-authored-by: Hanzo Dev <[email protected]>
21 lines
473 B
TypeScript
21 lines
473 B
TypeScript
import { afterAll, beforeAll } from "vitest";
|
|
|
|
const original = { ...console } as Record<string, any>;
|
|
|
|
function thrower(method: string) {
|
|
return (...args: any[]) => {
|
|
throw new Error(`Unexpected console.${method} call: ${args.join(" ")}`);
|
|
};
|
|
}
|
|
|
|
beforeAll(() => {
|
|
for (const method of ["log", "info", "warn", "error", "debug"] as const) {
|
|
// @ts-ignore
|
|
console[method] = thrower(method);
|
|
}
|
|
});
|
|
|
|
afterAll(() => {
|
|
Object.assign(console, original);
|
|
});
|