diff --git a/README.md b/README.md index 330a83c..491b8eb 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,30 @@ $ pnpm i ## Commands -| Command | Action | -| ------------------- | ---------------------------------------------- | -| `pnpm run dev` | start dev server | -| `pnpm run build` | generate static files to `dist` directory | -| `pnpm run deploy` | upload to my server | -| `pnpm run prep:now` | back up and clear current `now page` constants | -| `pnpm run patch:build:deploy` | increment version, build, then upload | +| Command | Action | +| ----------------------------- | ---------------------------------------------- | +| `pnpm run dev` | start dev server | +| `pnpm run build` | generate static files to `dist` directory | +| `pnpm run deploy` | upload to my server | +| `pnpm run prep:now` | back up and clear current `now page` constants | +| `pnpm run patch:build:deploy` | increment version, build, then upload | + +## Testing + +This project uses Vitest for unit tests. The test script is defined in `package.json` as `vitest run .`. + +Run tests locally with pnpm (recommended): + +```bash +# install dependencies (if you haven't already) +pnpm i + +# run tests once +pnpm test + +# run Vitest in interactive/watch mode +pnpm exec vitest +``` ## Deployment diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..822c411 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'vitest/config' + +// Exclude generated files and heavy folders from the watcher to avoid +// continuous re-runs when build output or other tools touch files. +export default defineConfig({ + test: { + globals: true, + environment: 'node', + exclude: ['dist/**', 'public/**', 'node_modules/**'], + }, + watch: { + exclude: ['dist/**', 'public/**', 'node_modules/**', '.git/**'], + }, +})