Skip to content
pre-alpha — the TypeScript API may still shift. The SQL won't.

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
sqlfu.config.ts
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
definitions.sql
create table posts (id integer primary key);
sqlfu.config.ts
export default {
db: './app.db',
migrations: './migrations',
definitions: './definitions.sql',
queries: './sql',
generate: {validator: 'not-a-real-validator' as any},
};
sql/list-posts.sql
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
definitions.sql
create table posts (id integer primary key);
sqlfu.config.ts
export default {
db: './app.db',
migrations: './migrations',
definitions: './definitions.sql',
queries: './sql',
generate: {zod: true} as any,
};
sql/list-posts.sql
select id from posts;
error

“generate.zod” is no longer supported[\s\S]+generate.validator