nuxt / nuxt/test-utils

[test-utils] testing for prerender build

Open
#343 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
437
Forks
120
Avg merge
22h 52m
Merged PRs (30d)
23

Description

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: https://github.com/nuxt-modules/i18n/pull/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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the @nuxt/test-utils setup and trace how the nuxtConfig _generate: true option invokes nuxi generate and then starts the server. Reproduce the missing output/server/index.mjs failure, then verify that a prerender test can run without stopping on that missing module.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.