Skip to content

Commit 45ea812

Browse files
committed
Stop importing from src in tests
5x more imports of dist than src Importing from src doesn't typecheck.
1 parent e9a2cb1 commit 45ea812

File tree

15 files changed

+16
-24
lines changed

15 files changed

+16
-24
lines changed

packages/next/src/server/config-schema.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const zSizeLimit = z.custom<SizeLimit>((val) => {
2727
return false
2828
})
2929

30-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
3130
const zExportMap: zod.ZodType<ExportPathMap> = z.record(
3231
z.string(),
3332
z.object({
@@ -40,7 +39,6 @@ const zExportMap: zod.ZodType<ExportPathMap> = z.record(
4039
})
4140
)
4241

43-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
4442
const zRouteHas: zod.ZodType<RouteHas> = z.union([
4543
z.object({
4644
type: z.enum(['header', 'query', 'cookie']),
@@ -54,7 +52,6 @@ const zRouteHas: zod.ZodType<RouteHas> = z.union([
5452
}),
5553
])
5654

57-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
5855
const zRewrite: zod.ZodType<Rewrite> = z.object({
5956
source: z.string(),
6057
destination: z.string(),
@@ -65,7 +62,6 @@ const zRewrite: zod.ZodType<Rewrite> = z.object({
6562
internal: z.boolean().optional(),
6663
})
6764

68-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
6965
const zRedirect: zod.ZodType<Redirect> = z
7066
.object({
7167
source: z.string(),
@@ -89,7 +85,6 @@ const zRedirect: zod.ZodType<Redirect> = z
8985
])
9086
)
9187

92-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
9388
const zHeader: zod.ZodType<Header> = z.object({
9489
source: z.string(),
9590
basePath: z.literal(false).optional(),
@@ -101,7 +96,6 @@ const zHeader: zod.ZodType<Header> = z.object({
10196
internal: z.boolean().optional(),
10297
})
10398

104-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
10599
const zTurboLoaderItem: zod.ZodType<TurboLoaderItem> = z.union([
106100
z.string(),
107101
z.object({
@@ -111,7 +105,6 @@ const zTurboLoaderItem: zod.ZodType<TurboLoaderItem> = z.union([
111105
}),
112106
])
113107

114-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
115108
const zTurboRuleConfigItemOptions: zod.ZodType<TurboRuleConfigItemOptions> =
116109
z.object({
117110
loaders: z.array(zTurboLoaderItem),
@@ -130,7 +123,6 @@ const zTurboRuleConfigItem: zod.ZodType<TurboRuleConfigItem> = z.union([
130123
const zTurboRuleConfigItemOrShortcut: zod.ZodType<TurboRuleConfigItemOrShortcut> =
131124
z.union([z.array(zTurboLoaderItem), zTurboRuleConfigItem])
132125

133-
// @ts-ignore ts check incompatible due to `strictNullChecks: false`
134126
export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
135127
z.strictObject({
136128
amp: z

test/development/basic/next-rs-api.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NextInstance, createNext } from 'e2e-utils'
2-
import { trace } from 'next/src/trace'
2+
import { trace } from 'next/dist/trace'
33
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants'
44
import {
55
createDefineEnv,
@@ -11,8 +11,8 @@ import {
1111
StyledString,
1212
TurbopackResult,
1313
UpdateInfo,
14-
} from 'next/src/build/swc'
15-
import loadConfig from 'next/src/server/config'
14+
} from 'next/dist/build/swc'
15+
import loadConfig from 'next/dist/server/config'
1616
import path from 'path'
1717

1818
function normalizePath(path: string) {

test/e2e/ignore-invalid-popstateevent/with-i18n.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { NextInstance } from 'e2e-utils'
44
import { check, waitFor } from 'next-test-utils'
55
import webdriver, { BrowserInterface } from 'next-webdriver'
66

7-
import type { HistoryState } from '../../../packages/next/src/shared/lib/router/router'
7+
import type { HistoryState } from 'next/dist/shared/lib/router/router'
88

99
const emitPopsStateEvent = (browser: BrowserInterface, state: HistoryState) =>
1010
browser.eval(

test/e2e/ignore-invalid-popstateevent/without-i18n.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { NextInstance } from 'e2e-utils'
44
import { check, waitFor } from 'next-test-utils'
55
import webdriver, { BrowserInterface } from 'next-webdriver'
66

7-
import type { HistoryState } from '../../../packages/next/src/shared/lib/router/router'
7+
import type { HistoryState } from 'next/dist/shared/lib/router/router'
88

99
const emitPopsStateEvent = (browser: BrowserInterface, state: HistoryState) =>
1010
browser.eval(

test/lib/e2e-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path'
22
import assert from 'assert'
3-
import { flushAllTraces, setGlobal, trace } from 'next/src/trace'
3+
import { flushAllTraces, setGlobal, trace } from 'next/dist/trace'
44
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants'
55
import { NextInstance, NextInstanceOpts } from './next-modes/base'
66
import { NextDevInstance } from './next-modes/next-dev'

test/lib/next-modes/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { NextConfig } from 'next'
66
import { FileRef, isNextDeploy, isNextDev } from '../e2e-utils'
77
import { ChildProcess } from 'child_process'
88
import { createNextInstall } from '../create-next-install'
9-
import { Span } from 'next/src/trace'
9+
import { Span } from 'next/dist/trace'
1010
import webdriver from '../next-webdriver'
1111
import { renderViaHTTP, fetchViaHTTP, waitFor } from 'next-test-utils'
1212
import cheerio from 'cheerio'

test/lib/next-modes/next-deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
TEST_TOKEN,
1010
} from '../../../scripts/reset-project.mjs'
1111
import fetch from 'node-fetch'
12-
import { Span } from 'next/src/trace'
12+
import { Span } from 'next/dist/trace'
1313

1414
export class NextDeployInstance extends NextInstance {
1515
private _cliOutput: string

test/lib/next-modes/next-dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import spawn from 'cross-spawn'
2-
import { Span } from 'next/src/trace'
2+
import { Span } from 'next/dist/trace'
33
import { NextInstance } from './base'
44
import { getTurbopackFlag } from '../turbo'
55
import stripAnsi from 'strip-ansi'

test/lib/next-modes/next-start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path'
22
import fs from 'fs-extra'
33
import { NextInstance } from './base'
44
import spawn from 'cross-spawn'
5-
import { Span } from 'next/src/trace'
5+
import { Span } from 'next/dist/trace'
66
import stripAnsi from 'strip-ansi'
77

88
export class NextStartInstance extends NextInstance {

test/unit/cssnano-simple/cssnano-simple/basic.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import postcss from 'postcss'
22

3-
import mod from 'next/src/bundles/cssnano-simple/index'
3+
import mod from 'next/dist/compiled/cssnano-simple/index'
44
import css from '../noop-template'
55

66
describe('basic test', () => {

test/unit/cssnano-simple/cssnano-simple/exclude-all.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import postcss from 'postcss'
22

3-
import mod from 'next/src/bundles/cssnano-simple/index'
3+
import mod from 'next/dist/compiled/cssnano-simple/index'
44
import css from '../noop-template'
55

66
describe('exclude all test', () => {

test/unit/cssnano-simple/cssnano-simple/plugin-config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import postcss from 'postcss'
22

3-
import mod from 'next/src/bundles/cssnano-simple/index'
3+
import mod from 'next/dist/compiled/cssnano-simple'
44
import css from '../noop-template'
55

66
describe('accepts plugin configuration', () => {

test/unit/web-runtime/next-request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import { expectTypeOf } from 'expect-type'
6-
import { NextRequest } from 'next/src/server/web/spec-extension/request'
6+
import { NextRequest } from 'next/dist/server/web/spec-extension/request'
77

88
it('should have 1 required parameter for constructor', () => {
99
expect(NextRequest.length).toBe(1)

test/unit/web-runtime/next-response-cookies.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment @edge-runtime/jest-environment
33
*/
44

5-
import { NextResponse } from 'next/src/server/web/spec-extension/response'
5+
import { NextResponse } from 'next/dist/server/web/spec-extension/response'
66

77
it('reflect .set into `set-cookie`', async () => {
88
const response = new NextResponse()

test/unit/web-runtime/next-response.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment @edge-runtime/jest-environment
33
*/
44

5-
import { NextResponse } from 'next/src/server/web/spec-extension/response'
5+
import { NextResponse } from 'next/dist/server/web/spec-extension/response'
66

77
const toJSON = async (response: Response) => ({
88
body: await response.json(),

0 commit comments

Comments
 (0)