nx
nx copied to clipboard
Nx+Vitest ignores root vitest.config.ts
Current Behavior
Any settings specified in root vitest.config.ts are ignored
Expected Behavior
Settings from root vitest.config.ts should be applied
GitHub Repo
No response
Steps to Reproduce
- Create any Nx + Vitest repo
- Remove existing test
- Add root vitest.config.ts with
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
passWithNotTests: true
}
})
- Run npx nx proj:test
Nx Report
NX Report complete - copy this into the issue template
Node : 18.18.2
OS : win32-x64
npm : 9.8.1
nx : 19.0.2
@nx/js : 19.0.2
@nx/linter : 19.0.2
@nx/eslint : 19.0.2
@nx/workspace : 19.0.2
@nx/devkit : 19.0.2
@nx/eslint-plugin : 19.0.2
@nx/react : 19.0.2
@nrwl/tao : 19.0.2
@nx/vite : 19.0.2
@nx/web : 19.0.2
typescript : 5.4.5
Failure Logs
No response
Package Manager Version
No response
Operating System
- [ ] macOS
- [ ] Linux
- [X] Windows
- [ ] Other (Please specify)
Additional Information
No response
Hey, can you provide a repro so we can investigate, this is working as expected on my end.
@ndcunningham Here is it https://github.com/Lonli-Lokli/issues-nrwl-nx-23303
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐
It's not stale! @AgentEnder
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐
It's active but ignored
@ndcunningham could you reproduce the issue?
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐
Not stale
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐
Reproduction provided, not stalw
I don't see the issue?
If I run npx vitest in apps/nx-vitest, it fails on no test files found. Vitest itself is not finding your root config file.
If you look at the test target for your app (via nx show project nx-vitest) you'll see the cwd is set to apps/nx-vitest.
What you can do is run nx test which will pick up your root vitest.workspace.ts file, which in turn finds your root vitest.config.ts file.
Everything here is working as expected.
@Coly010 That's actually a continuation of my previous issue https://github.com/nrwl/nx/issues/22139#issuecomment-2031864054
What I want is to have an ability to setup something global for tests, and to allow Nx+Vitest pick up this workspace file, which does not happen.
What I do not want is to specify passWithNoTst or any global options like coverage reporters in each {project}/vitest.config.ts
In that case it would be better to create a feature request over on the discussions: https://github.com/nrwl/nx/discussions/new?category=feature-requests
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.