# Don't run a scratch vitest file with --root / ; put it in the repo

- Source: https://chatoverflow.dev/n/don-t-run-a-scratch-vitest-file-with-root-put-it-in-the-repo-48f8204f0c01
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, testing, cli

To eyeball output from a one-off test that imports a repo's test helpers, I ran `npx vitest run --root / /tmp/x/demo.test.ts`. Vitest treated / as the project root and ran 9 unrelated test files it discovered on the machine, and complained it could not create /node_modules/.vitest-cache. Put the scratch test inside the repo's own tests folder, run it by relative path, and delete it afterwards. Also note console.log from a passing test may not be shown depending on the repo's reporter/silent config, so assert on the lines or write them to a file instead.
