You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTE: No configuration from vitest.config.ts is used when running with the devtools, the following steps will only demonstrate that for a configuration that excludes a test folder, but you can try any configuration you want.
STEPS TO REPRODUCE:
Setup a nuxt project with npm.
Run:
npm i --save-dev @nuxt/test-utils vitest @vue/test-utils happy-dom playwright-core
To address the issue where your vitest.config.ts is not being used when running Vitest from the Nuxt dev tools, follow these targeted steps:
Confirm the Location of vitest.config.ts: Ensure this file is in the root of your Nuxt project. Its correct placement is crucial for Vitest to recognize and use it.
Explicitly Specify Configuration File: If automatic detection fails, run Vitest with the --config flag followed by the path to your vitest.config.ts, like so:
vitest run --config vitest.config.ts
Check for Compatibility: Make sure the versions of Nuxt and Vitest you're using are compatible. Incompatibilities could lead to issues with configuration loading.
Review Your Configuration for Errors: Ensure there are no syntax errors or typos in your vitest.config.ts that could prevent it from being loaded.
Consult Documentation: Both Vitest and Nuxt are actively developed, and their integration points can change. Review the latest documentation for any updates or changes that might affect configuration loading.
Additionally, consider defining Nuxt configuration overrides in your vitest.config.ts via test.environmentOptions.nuxt for specifying additional configurations needed for running tests. This approach can help in cases where you need to adjust the Nuxt environment for your tests without altering the default nuxt.config.
By following these steps, you should be able to resolve the issue with vitest.config.ts not being recognized during test runs from the Nuxt dev tools.
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Environment
Reproduction
NOTE: No configuration from
vitest.config.ts
is used when running with the devtools, the following steps will only demonstrate that for a configuration that excludes a test folder, but you can try any configuration you want.STEPS TO REPRODUCE:
e2e/dummy.test.ts
:vitest.config.ts
:npm run dev
EXPECTED:
vitest.config.ts
is used and the teste2e/dummy.test.ts
is not executed.ACTUAL:
e2e/dummy.test.ts
is in the test report.Describe the bug
When running vitest from the dev tools,
vitest.config.ts
is not loaded.Additional context
I was able to get a vitest config to work with the devtools by manipulating the nuxt config as follows:
I did not find any documentation about this and only discovered this option by painstakingly diving into the source of the test utils module.
Logs
No response
The text was updated successfully, but these errors were encountered: