rsnext/test
Damien Simonin Feugas 3c87e1b52a
chore: improves console warnings related to edge runtime (#44563)
## 📖 What's in there?

With Edge Function GA for API Routes, it would make sense to suggest
developer to change their runtime key from `experimental-edge` to
`edge`.

Current behavior is:
1. when using `experimental-edge` in API route: 
> prints a warning _once:_ `warn - You are using an experimental edge
runtime, the API might change.`
   
1. when using `experimental-edge` in pages:
> prints a warning _once:_ `warn - You are using an experimental edge
runtime, the API might change. `
   
1. when using `edge` in pages:
> throws an error _for each page_: `error - Page /xyz provided runtime
'edge', the edge runtime for rendering is currently experimental. Use
runtime 'experimental-edge' instead.`

This PR adjust case # 1 to indicates which API file is using
`experimental-edge` (a warning per page), and suggest to migrate:
`warn - /pages/api/xyz provided runtime 'experimental-edge'. It can be
updated to 'edge' instead.`

- [x] Integration tests added

## 🧪 How to test?

Besides running e2e tests with `NEXT_TEST_MODE=dev pnpm testheadless
--testPathPattern edge-configurable-runtime`, you can create a test app
in `examples` folder:
```jsx
// examples/edge-warnings/pages/api/edge.js
export default () => new Response('ok')
export const config = { runtime: 'experimental-edge' }

// examples/edge-warnings/pages/index.jsx
export default () => <p>hello world</p>
export const runtime = 'experimental-edge'
```

Build next.js then run with `pnpm next dev examples/edge-warnings`.

You can try adding more pages with `experimental-edge` runtime (will not
produce more warnings), adding more API with `experimental-edge` (will
produce new warnings), or change page runtime to `edge` (will produce
errors).
2023-01-06 11:28:51 -08:00
..
.stats-app Remove serverComponents from next.conf.js because it's unused (#43805) 2022-12-07 15:57:03 +01:00
__mocks__ Update Edge Runtime (#38862) 2022-07-21 18:29:19 +00:00
development Improve errors caused by Next.js client hook called in a server component (#44588) 2023-01-06 02:21:56 +00:00
e2e chore: improves console warnings related to edge runtime (#44563) 2023-01-06 11:28:51 -08:00
integration Add updated flush handling on sigterm (#44614) 2023-01-06 16:20:01 +01:00
lib Change NextInstance.fetch Signature (#44575) 2023-01-05 16:31:03 +01:00
production Update subset validation in @next/font/google and fix CJK bug (#44594) 2023-01-05 15:51:38 -08:00
unit Fix font unit test on Azure (#44618) 2023-01-05 18:55:21 -08:00
.gitignore Fix server html insertion target (#42591) 2022-11-07 18:16:13 +01:00
jest-setup-after-env.ts Adds tests to ensure eslint-plugin-next's available rules are properly exported and recommended rules are correctly defined. (#38183) 2022-06-30 11:31:33 -05:00
jest.d.ts Adds tests to ensure eslint-plugin-next's available rules are properly exported and recommended rules are correctly defined. (#38183) 2022-06-30 11:31:33 -05:00
readme.md refactor: split up CONTRIBUTING.md (#40515) 2022-09-16 14:54:58 -07:00
test-file.txt Add additional file serving tests (#12479) 2020-05-04 11:58:19 -05:00

See Testing for more information on how you can run/write/debug tests for Next.js.