Skip to content
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

ctx.nuxt does not exist when build: false in setup #936

Merged
merged 5 commits into from
Dec 5, 2024

Conversation

Al-Rozhkov
Copy link
Contributor

@Al-Rozhkov Al-Rozhkov commented Sep 9, 2024 β€’

πŸ”— Linked issue

Resolves #918
resolves #995

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 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

Sorry, something went wrong.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Sep 9, 2024
@Boluwatife2904
Copy link

Boluwatife2904 commented Sep 9, 2024 β€’

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 πŸ™πŸ½

Al-Rozhkov and others added 2 commits September 10, 2024 09:40

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe
@danielroe
Copy link
Member

Would you be able to add a test in examples/app-vitest/test/build-false.e2e.spec.ts? πŸ™

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Sep 10, 2024
@danielroe
Copy link
Member

Thank you πŸ™

Can you explain a bit about why you would do this rather than passing that config to setup?

@Al-Rozhkov
Copy link
Contributor Author

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.

@skoenfaelt
Copy link

Thank you πŸ™

Can you explain a bit about why you would do this rather than passing that config to setup?

Maybe this helps
#314 (comment)

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

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@danielroe danielroe merged commit bddac9e into nuxt:main Dec 5, 2024
4 checks passed
@github-actions github-actions bot mentioned this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
4 participants