Ideally, we could set a path to a different tsconfig in the vitest configuration. However, I couldn't find such an option.
A workaround that might work in some scenarios would be an inverted pattern:
- Instead of having a main
tsconfig.json to build the project and a tsconfig.test.json to run the tests
- We could use
tsconfig.json for editor support inside the whole project (including tests) and for defining the test tsconfig options (vitest will pick those up)
- Then use a separate
tsconfig.build.json to define only build relevant settings (tsc -p ./tsconfig.build.json)
This allows to limit emitted build output by rootDir, include, etc.