Repository: next.js
Issue: Tests failing after upgrade to v14 when run from Jest VSCode extension: Response is not defined
Labels: bug,Testing

### Link to the code that reproduces this issue

https://github.com/alexXxSG/nextjs14-jest-issue

### To Reproduce

1. Download the example from https://github.com/vercel/next.js/tree/canary/examples/with-jest
2. Add a file named `/app/api/me/route.ts` with the following content:

```js
import { NextResponse } from "next/server"

export async function GET() {
  const data = { message: "It's me, Mario" }
  return NextResponse.json(data, { status: 200 })
}

```

4. Add the test to `/__tests__/api.test.ts`:

```js
/**
 * @jest-environment jest-environment-node
 */

import { GET } from "./route"

describe("/api/me", () => {
  it("returns message", async () => {
    const expected = { message: "It's me, Mario" }

    const response = await GET()
    const data = await response.json()

    expect(data).toEqual(expected)
  })
})

```
5. Run the test using the VSCode extension https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest
6. See the error:
```bash
> test
> jest --watch --testLocationInResults --json --useStderr --outputFile C:\Users\[UserId]\AppData\Local\Temp\jest_runner_with_jest_app_[UserId]_2.json --no-coverage --reporters default --reporters c:\Users\[UserId]\.vscode\extensions\orta.vscode-jest-5.2.3\out\reporter.js --colors --watchAll=false


> Test run started at 12/28/2023, 12:32:18 PM <

 FAIL  __tests__/api.test.ts
  ● Test suite failed to run

    ReferenceError: Response is not defined



      at Object.Response (node_modules/next/src/server/web/spec-extension/response.ts:29:51)
      at Object.<anonymous> (app/api/me/route.ts:11:62)
      at Object.<anonymous> (__tests__/api.test.ts:7:16)

 PASS  app/counter.test.tsx
 PASS  __tests__/index.test.tsx
 PASS  app/blog/[slug]/page.test.tsx
 PASS  __tests__/snapshot.tsx
 PASS  app/page.test.tsx
 PASS  app/utils/add.test.ts


> Test run finished at 12/28/2023, 12:32:21 PM <

Test Suites: 1 failed, 6 passed, 7 total
Tests:       6 passed, 6 total
Snapshots:   1 passed, 1 total
Time:        2.979 s
Ran all test suites.

> Test run exited at 12/28/2023, 12:32:22 PM <
```


### Current vs. Expected behavior

It should return all tests passed, as in prev versions of nextjs (v13.5.6)

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
VSCode 1.85.1
Jest VSCode extension v5.2.3


Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Enterprise
Binaries:
  Node: 20.9.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.0.5-canary.29
  eslint-config-next: N/A
  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)

Not sure, Jest (next/jest)

### Additional context

**This issue is only visible when running the tests using vscode jest extension**

 **This issue does not happen in nextjs v13.5.6**

When running tests via CLI, all tests pass, no matter the nextjs version:

```bash
 PASS  __tests__/api.test.ts
 PASS  __tests__/snapshot.tsx
 PASS  __tests__/index.test.tsx

Test Suites: 3 passed, 3 total
Tests:       3 passed, 3 total
Snapshots:   1 passed, 1 total
Time:        1.882 s
Ran all test suites related to changed files.
```