Errors
Error-case fixtures: sqlfu generate should refuse to run and throw a specific message. The
error block inside each test is treated as a regular expression that must match the thrown
error message.
Every test here overrides sqlfu.config.ts with a broken config — the default config block
below is the one they’re comparing against, and isn’t used directly by any test.
default config
export default { db: './app.db', migrations: './migrations', definitions: './definitions.sql', queries: './sql',};rejects unknown validator values at config load
Section titled “rejects unknown validator values at config load”input
create table posts (id integer primary key);export default { db: './app.db', migrations: './migrations', definitions: './definitions.sql', queries: './sql', generate: {validator: 'not-a-real-validator' as any},};select id from posts;error
“generate.validator” must be one of ‘arktype’, ‘valibot’, ‘zod’, ‘zod-mini’, null, or undefined
rejects the legacy generate.zod flag with a migration hint
Section titled “rejects the legacy generate.zod flag with a migration hint”input
create table posts (id integer primary key);export default { db: './app.db', migrations: './migrations', definitions: './definitions.sql', queries: './sql', generate: {zod: true} as any,};select id from posts;error
“generate.zod” is no longer supported[\s\S]+generate.validator