-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e tests fail with .config/nuxt.ts
#893
Comments
Hey @nathanchase! I'm here to assist you with any issues you may have. I can help you solve bugs, answer questions, and become a contributor. Let me know how I can help you with the Nuxt configuration problem you're experiencing. To resolve the issue with using an alternative // ./tests/basic.e2e.test.ts
import { $fetch, setup } from '@nuxt/test-utils/e2e';
import { describe, expect, it } from 'vitest';
describe('basic', async () => {
await setup({
rootDir: './app',
environmentOptions: {
nuxt: {
configFile: './.config/nuxt.ts', // Ensure the correct path to your config file
},
},
});
it('contains Welcome to Nuxt! string', async () => {
const html = await $fetch('/');
expect(html).toContain('Welcome to Nuxt!');
});
}); Make sure the path to your |
environmentOptions is not a property of the setup() function's options. The correct property is |
You are correct. The // ./tests/basic.e2e.test.ts
import { $fetch, setup } from '@nuxt/test-utils/e2e';
import { describe, expect, it } from 'vitest';
describe('basic', async () => {
await setup({
rootDir: './app',
configFile: './.config/nuxt.ts', // Ensure the correct path to your config file
});
it('contains Welcome to Nuxt! string', async () => {
const html = await $fetch('/');
expect(html).toContain('Welcome to Nuxt!');
});
}); Make sure the path to your |
|
.config/nuxt.ts
If I set await setup({
configFile: '/.config/nuxt.ts',
}); |
Environment
Reproduction: https://stackblitz.com/edit/github-gu1sj1?file=tests%2Fbasic.e2e.test.ts
I can't seem to utilize the alternative nuxt.config location with @nuxt/test-utils. If I have my nuxt.config as
./.config/nuxt.ts
, e2e tests will always fail withError: Invalid nuxt app. (Please explicitly set 'options.rootDir' pointing to a valid nuxt app)
.This is my test:
and my nuxt.config:
If I move and rename nuxt.config back to the root, it works.
I'm not sure if this is a limitation or expectation of test-utils of the config file name/location that isn't being honored by the
configFile
setting, or what.Reproduction
https://stackblitz.com/edit/github-gu1sj1?file=tests%2Fbasic.e2e.test.ts
Describe the bug
Using alternative nuxt.config name/location causes e2e tests to fail.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: