test-utils icon indicating copy to clipboard operation
test-utils copied to clipboard

Setting `javaScriptEnabled: false` in `createPage()` never loads page

Open dulnan opened this issue 1 year ago • 1 comments

Environment

------------------------------
- Operating System: Linux
- Node Version:     v20.14.0
- Nuxt Version:     3.12.2
- CLI Version:      3.12.0
- Nitro Version:    2.9.6
- Package Manager:  [email protected]
- Builder:          -
- User Config:      -
- Runtime Modules:  -
- Build Modules:    -
------------------------------

Reproduction

Call createPage() by passing javaScriptEnabled: false in the options:

const page = await createPage('/foobar', {
    javaScriptEnabled: false,
  })

Describe the bug

This will never finish loading the page because the createPage method always waits for hydration to finish. In this case, hydration can't ever finish, so the method's Promise never resolves.

Additional context

Probably a rare use case, but I ran into this issue while explicitly wanting to test the unhydrated SSR output of a page.

Logs

No response

dulnan avatar Jun 16 '24 10:06 dulnan