-
Notifications
You must be signed in to change notification settings - Fork 86
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
The "setup" in the tests is very slow for every rerun #314
Comments
I think @antfu was working on a PR to avoid restarting/rebuilding Nuxt when rerunning tests. Also relevant: nuxt/framework#4578. |
Besides not re-building on every test (re-)run it would be even better if server could be re-built separately if only server-side code changed (e.g. an API) 🙃 |
In either case, eagerly awaiting for a change here, cause otherwise running tests is pretty painful atm |
@danielroe Is it possible to have a dev. instance running & to use that as the "server" for the e2e tests? I don't really care about building all the time as the built version will run in the pipeline anyway . It would be nice to skip "building" and just to use the "npm run dev" server I have running. |
I managed to avoid rebuilding every time by building into npm run build
mv .output .output1 && mkdir .output && mv .output1 .output/output And then setting output directory to // playwright.config.ts
export default defineConfig<ConfigOptions>({
use: {
nuxt: {
build: false,
buildDir: ".output",
rootDir: fileURLToPath(new URL(".", import.meta.url)),
},
},
}) For now nuxt always sets
|
You are amazing @nWacky ! export default defineConfig<ConfigOptions>({
use: {
nuxt: {
build: false,
buildDir: '.output',
nuxtConfig: {
nitro: {
output: {
dir: '.output',
},
},
},
rootDir: fileURLToPath(new URL('.', import.meta.url)),
},
}) |
Wrapping nuxt setup: OBS: The test now takes 5 seconds, previously it took around 50 seconds import { setup } from '@nuxt/test-utils/e2e'
import type { TestOptions } from '@nuxt/test-utils/e2e'
export const setupNuxt = (options?: Partial<TestOptions>) => {
return setup({
build: false,
buildDir: '.output',
nuxtConfig: {
nitro: {
output: {
dir: '.output',
},
},
},
...options
})
} |
Hi @linspw I'm trying to implement the changes you have here but I'm running into an error
did you not experience this? |
Having the same problem. |
I found a workaround by starting a dev/preview server and then running tests against that until there is a better solution
|
|
TypeError: Cannot read properties of undefined (reading 'options') i am having this issue as well. |
Environment
Linux
v16.14.2
3.0.0-rc.12
0.6.0
npm@7.17.0
vite
-
-
-
Reproduction
https://stackblitz.com/edit/nuxt-framework-zehqm6
Describe the bug
The empty
await setup({})
in the tests takes ~4 seconds for every rerun inwatch
mode in the empty project.Please, check the reproduction, try to run
npm test
.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: