Skip to content

test mode does not work with Pages Router #61440

@AkifumiSato

Description

@AkifumiSato

Link to the code that reproduces this issue

https://github.com/AkifumiSato/pages-to-app-router-demo

To Reproduce

  1. implement getServerSideProps with fetch.
  2. next dev --experimental-test-proxy
  3. page access with playwright test.

Current vs. Expected behavior

The following error occurs.

> playwright test
[WebServer]  ⨯ Error: No test info for GET https://dummyjson.com/products/1
    at handleFetch (/Users/xxxx/work/git/sandbox/pages-to-app-router-demo/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/experimental/testmode/fetch.js:89:15)
...

I would like to see a statement in the documentation that it does not work with Pages Router.
Ideally, msw would work with Pages Router as well.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.6.0: Wed Oct  4 23:56:02 PDT 2023; root:xnu-8020.240.18.704.15~1/RELEASE_ARM64_T6000
Binaries:
  Node: 18.17.0
  npm: 9.8.0
  Yarn: N/A
  pnpm: 8.9.0
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Data fetching (gS(S)P, getInitialProps)

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local), Other (Deployed)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pages RouterRelated to Pages Router.bugIssue was opened via the bug report template.staleThe issue has not seen recent activity.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions