test: read isNextDev/isNextDeploy/isNextStart from e2e-utils (#100419)
## Summary Replaces 93 `global.isNextDev` / `isNextDeploy` / `isNextStart` reads in tests with the typed constants that `e2e-utils` already exports. 92 of these went through `(global as any)` and one, in `i18n-hybrid.test.ts`, was uncast. The values are the same, and `nextTestSetup()` returns getters for these exports. The global is `true | undefined` and the export is a boolean. Every replaced read is a boolean check (`if`, `!`, ternaries, defaulted parameters), so test behaviour does not change. Some tests destructure `isNextDev` from `nextTestSetup()` and also read the global inside that same call. Those now use the import, to avoid a temporal-dead-zone reference. Two places keep using the global on purpose: - `test/lib/e2e-utils/index.ts` still sets it. - `getDistDir()` in `test/lib/next-test-utils.ts` still reads it. That file is also used by tests that don't import `e2e-utils`, and importing that module would run its side effects. ## Verification - Ran `tsc --noEmit` for the root project. The only errors are in untouched tests that import `next/dist` modules. - eslint and prettier pass on all changed files. - Checked every replaced read for non-boolean use. For example, values passed into `runTests(isDev, isDeploy)` are only used as conditions. <!-- NEXT_JS_LLM -->
Showing
Please
register
or
sign in
to comment