Skip to content

Commit d1dc85d

Browse files
committed
update tests
1 parent 14cfe09 commit d1dc85d

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

test/integration/tsconfig-verifier/test/index.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import path from 'path'
5252
"strictNullChecks": true
5353
},
5454
"include": [
55-
"next-env.d.ts",
5655
".next/types/**/*.ts",
5756
".next/dev/types/**/*.ts",
5857
"**/*.mts",
@@ -109,7 +108,6 @@ import path from 'path'
109108
"strictNullChecks": true
110109
},
111110
"include": [
112-
"next-env.d.ts",
113111
".next/types/**/*.ts",
114112
".next/dev/types/**/*.ts",
115113
"**/*.mts",
@@ -185,7 +183,6 @@ import path from 'path'
185183
// in-object comment 2
186184
,
187185
"include": [
188-
"next-env.d.ts",
189186
".next/types/**/*.ts",
190187
".next/dev/types/**/*.ts",
191188
"**/*.mts",
@@ -240,7 +237,6 @@ import path from 'path'
240237
"strictNullChecks": true
241238
},
242239
"include": [
243-
"next-env.d.ts",
244240
".next/types/**/*.ts",
245241
".next/dev/types/**/*.ts",
246242
"**/*.mts",
@@ -294,7 +290,6 @@ import path from 'path'
294290
"strictNullChecks": true
295291
},
296292
"include": [
297-
"next-env.d.ts",
298293
".next/types/**/*.ts",
299294
".next/dev/types/**/*.ts",
300295
"**/*.mts",
@@ -352,7 +347,6 @@ import path from 'path'
352347
"strictNullChecks": true
353348
},
354349
"include": [
355-
"next-env.d.ts",
356350
".next/types/**/*.ts",
357351
".next/dev/types/**/*.ts",
358352
"**/*.mts",
@@ -410,7 +404,6 @@ import path from 'path'
410404
"strictNullChecks": true
411405
},
412406
"include": [
413-
"next-env.d.ts",
414407
".next/types/**/*.ts",
415408
".next/dev/types/**/*.ts",
416409
"**/*.mts",
@@ -465,7 +458,6 @@ import path from 'path'
465458
"strictNullChecks": true
466459
},
467460
"include": [
468-
"next-env.d.ts",
469461
".next/types/**/*.ts",
470462
".next/dev/types/**/*.ts",
471463
"**/*.mts",
@@ -523,7 +515,6 @@ import path from 'path'
523515
"strictNullChecks": true
524516
},
525517
"include": [
526-
"next-env.d.ts",
527518
".next/types/**/*.ts",
528519
".next/dev/types/**/*.ts",
529520
"**/*.mts",
@@ -581,7 +572,6 @@ import path from 'path'
581572
"strictNullChecks": true
582573
},
583574
"include": [
584-
"next-env.d.ts",
585575
".next/types/**/*.ts",
586576
".next/dev/types/**/*.ts",
587577
"**/*.mts",
@@ -629,7 +619,6 @@ import path from 'path'
629619
"strictNullChecks": true
630620
},
631621
"include": [
632-
"next-env.d.ts",
633622
".next/types/**/*.ts",
634623
"**/*.mts",
635624
"**/*.ts",
@@ -688,7 +677,6 @@ import path from 'path'
688677
"strictNullChecks": true
689678
},
690679
"include": [
691-
"next-env.d.ts",
692680
".next/types/**/*.ts",
693681
"**/*.mts",
694682
"**/*.ts",
@@ -750,7 +738,6 @@ import path from 'path'
750738
"strictNullChecks": true
751739
},
752740
"include": [
753-
"next-env.d.ts",
754741
".next/types/**/*.ts",
755742
"**/*.mts",
756743
"**/*.ts",
@@ -821,7 +808,6 @@ import path from 'path'
821808
"strictNullChecks": true
822809
},
823810
"include": [
824-
"next-env.d.ts",
825811
".next/types/**/*.ts",
826812
"**/*.ts",
827813
"**/*.tsx"

test/integration/typescript-app-type-declarations/test/index.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { promises as fs } from 'fs'
66

77
const appDir = join(__dirname, '..')
88
const rootTypeDeclarations = join(appDir, 'next-env.d.ts')
9-
const distTypeDeclarations = join(appDir, '.next/types/next-env.d.ts')
9+
const distTypeDeclarations = join(appDir, '.next/dev/types/next-env.d.ts')
1010

1111
describe('TypeScript App Type Declarations', () => {
1212
it('should not create next-env.d.ts in project root', async () => {
@@ -49,18 +49,16 @@ describe('TypeScript App Type Declarations', () => {
4949
}
5050
})
5151

52-
it('should overwrite next-env.d.ts in .next/types if incorrect', async () => {
53-
// Create .next/types directory and write incorrect content
54-
await fs.mkdir(join(appDir, '.next/types'), { recursive: true })
55-
await fs.writeFile(distTypeDeclarations, '// incorrect content\n')
52+
it('should generate next-env.d.ts in .next/types', async () => {
53+
// Clean up any existing .next directory
54+
await fs.rm(join(appDir, '.next'), { recursive: true, force: true })
5655

5756
const appPort = await findPort()
5857
let app
5958
try {
6059
app = await launchApp(appDir, appPort, {})
61-
// Verify next-env.d.ts was overwritten with correct content
60+
// Verify next-env.d.ts was generated in .next/types
6261
const content = await fs.readFile(distTypeDeclarations, 'utf8')
63-
expect(content).not.toEqual('// incorrect content\n')
6462
expect(content).toContain('/// <reference types="next" />')
6563
} finally {
6664
await killApp(app)

test/integration/typescript-app-type-declarations/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,10 @@
1717
"isolatedModules": true
1818
},
1919
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"],
20-
"include": ["components", "pages", ".next/types/**/*.ts"]
20+
"include": [
21+
"components",
22+
"pages",
23+
".next/types/**/*.ts",
24+
".next/dev/types/**/*.ts"
25+
]
2126
}

0 commit comments

Comments
 (0)