chore: add test config and instructions
This commit is contained in:
parent
4860085aef
commit
f2bbfbf1b4
2 changed files with 38 additions and 7 deletions
31
README.md
31
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
|
||||
|
||||
|
|
|
|||
14
vitest.config.ts
Normal file
14
vitest.config.ts
Normal file
|
|
@ -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/**'],
|
||||
},
|
||||
})
|
||||
Loading…
Reference in a new issue