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

[test-utils] testing for prerender build #343

Open
3 of 4 tasks
kazupon opened this issue Dec 15, 2022 · 2 comments
Open
3 of 4 tasks

[test-utils] testing for prerender build #343

kazupon opened this issue Dec 15, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@kazupon
Copy link
Member

kazupon commented Dec 15, 2022

Describe the feature

If we have a special implementation in the prerender environment, we may want to test it with its built from time to time.
case: nuxt-modules/i18n#1733

In @nuxt/test-utils setup, we can override the nuxtConfig option with _generate: true, which is equivalent to nuxi generate.

However, the server in @nuxt/test-utils is not yet ready to run a server for the prerender environment, so the test will stop with the following log output:

Error: Cannot find module '/path/to/nuxt/i18n/specs/fixtures/basic/.nuxt/ubpgju/output/server/index.mjs'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@pi0
Copy link
Member

pi0 commented Dec 15, 2022

Hi dear @kazupon. _generate is an internal flag an indeed unsupported for test-utils at the moment. What you can do, is to alternatively enable experimental.payloadExtraction and also enable nitro.prerender.crawlLinks: true. This generates server that serves static files as well. You can also use X-Powered-By header to assert if response is static or rendered on demand.

@pi0 pi0 added the enhancement New feature or request label Dec 15, 2022
@kazupon
Copy link
Member Author

kazupon commented Dec 15, 2022

Thank you for your kindful comment, as always! ❤️

I’ve felt that _generate is for internal.
About experimental.payloadExtraction and nitro.prerender.crawlLinks: true, those are good and helpful for me. :)
Thanks!

@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/nuxt Nov 6, 2023
@danielroe danielroe transferred this issue from nuxt/test-utils Dec 2, 2023
@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Apr 24, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label May 1, 2024
@danielroe danielroe reopened this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants