ctx.nuxt does not exist when build: false in setup
๐ Linked issue
Resolves #918
โ Type of change
- [ ] ๐ Documentation (updates to the documentation or readme)
- [X] ๐ Bug fix (a non-breaking change that fixes an issue)
- [ ] ๐ Enhancement (improving an existing functionality)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
Thank You so much for this @Al-Rozhkov. I've been wondering why I've unable to run my tests for a while without any luck.
@danielroe any chance this gets reviewed soon? Many thanks ๐๐ฝ
Would you be able to add a test in examples/app-vitest/test/build-false.e2e.spec.ts? ๐
Thank you ๐
Can you explain a bit about why you would do this rather than passing that config to setup?
Thank you ๐
Can you explain a bit about why you would do this rather than passing that config to setup?
I wasn't sure how to build Nuxt manually and make setup use exact that build. I would appreciate your advice.
Also not sure why windows tests failed.
Thank you ๐
Can you explain a bit about why you would do this rather than passing that config to setup?
Maybe this helps https://github.com/nuxt/test-utils/issues/314#issuecomment-2047815314
The dudes and I want to reduce the setup times for playwright testrunners. Since on every test the app makes a new prod build, very time consuming.
So we tried this config in the playwright.config.ts
export default defineConfig<ConfigOptions>({
use: {
nuxt: {
build: false,
buildDir: '.output',
nuxtConfig: {
nitro: {
output: {
dir: '.output',
},
},
},
rootDir: fileURLToPath(new URL('.', import.meta.url)),
},
})
with that we get this errror TypeError: Cannot read properties of undefined (reading 'options') at startServer...
Maybe this is the wrong approach, i dont know. What I know, my tests succeed locally but in the ci I get "Test timeout of 30000ms exceeded while setting up "_nuxtHooks"."
Setting the Timeout of each test to 2 minutes a workaround but far from effective. If we could reduce the build to one, it would be very helpful.
I have to build the frontend in the CI anyway before I copy it to the server, so it would make sense if the testrunner could use this artifact. --> build fe -use build artifact-> test e2e