Something went wrong. Try again.
A free, open-source, self-hosted place to write a novel.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536import { describe, expect, it } from 'vitest';import { readFileSync } from 'node:fs';import { resolve } from 'node:path';
/** * Under the project root, Vite's watcher sees a save to the SQLite database and its * WAL journal, decides a source file changed, and hard-reloads the page mid-sentence. * The end-to-end suite runs the built app, which has no watcher, so only this test * can see the rule. */describe('development watcher', () => { const config = readFileSync(resolve(process.cwd(), 'vite.config.ts'), 'utf8');
it('ignores SQLite databases and their journals', () => { expect(config).toContain('watch:'); expect(config).toMatch(/ignored:\s*\[/);
for (const pattern of ['**/*.db', '**/*.db-wal', '**/*.db-shm']) { expect(config).toContain(pattern); } });
it('ignores test uploads and drill records as well as databases', () => { expect(config).toContain("'**/.test-data/**'"); });
it('keeps the development database out of the source tree', () => { // A database under `src` or the project root makes a save look like an edit. // The default lives in `data/`, which the watcher and git both ignore. const env = readFileSync(resolve(process.cwd(), 'src/env.ts'), 'utf8');
expect(env).toContain("'data/dev.db'"); expect(env).not.toContain("'local.db'"); });});