Skip to content

Commit 1e157ef

Browse files
authored
Fix node16 tests (#48974)
1 parent eb1a8b1 commit 1e157ef

File tree

4 files changed

+757
-72
lines changed

4 files changed

+757
-72
lines changed

src/testRunner/unittests/tsbuild/moduleResolution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ namespace ts.tscWatch {
126126
path: `${projectRoot}/node_modules/pkg2`,
127127
symLink: `${projectRoot}/packages/pkg2`,
128128
},
129-
{ ...libFile, path: `/a/lib/lib.es2020.full.d.ts` }
129+
{ ...libFile, path: `/a/lib/lib.es2022.full.d.ts` }
130130
], { currentDirectory: projectRoot }),
131131
commandLineArgs: ["-b", "packages/pkg1", "-w", "--verbose", "--traceResolution"],
132132
changes: [

src/testRunner/unittests/tsbuild/moduleSpecifiers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ namespace ts {
178178
}`,
179179
}, ""),
180180
modifyFs: fs => {
181-
fs.writeFileSync("/lib/lib.es2020.full.d.ts", tscWatch.libFile.content);
181+
fs.writeFileSync("/lib/lib.es2022.full.d.ts", tscWatch.libFile.content);
182182
fs.symlinkSync("/src", "/src/src-types/node_modules");
183183
fs.symlinkSync("/src", "/src/src-dogs/node_modules");
184184
},

tests/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js

Lines changed: 281 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface Array<T> { length: number; [n: number]: T; }
1414
interface ReadonlyArray<T> {}
1515
declare const console: { log(msg: any): void; };
1616

17-
//// [/lib/lib.es2020.full.d.ts]
17+
//// [/lib/lib.es2022.full.d.ts]
1818
/// <reference no-default-lib="true"/>
1919
interface Boolean {}
2020
interface Function {}
@@ -134,33 +134,296 @@ Output::
134134

135135
[12:00:26 AM] Building project '/src/src-types/tsconfig.json'...
136136

137-
error TS6053: File '/lib/lib.es2022.full.d.ts' not found.
138-
The file is in the program because:
139-
Default library for target 'es2022'
137+
[12:00:33 AM] Project 'src/src-dogs/tsconfig.json' is out of date because output file 'src/src-dogs/dog.js' does not exist
140138

141-
[91merror[0m[90m TS2318: [0mCannot find global type 'Array'.
139+
[[90m12:00:34 AM[0m] Building project '/src/src-dogs/tsconfig.json'...
142140

143-
error TS2318: Cannot find global type 'Boolean'.
141+
exitCode:: ExitStatus.Success
142+
143+
144+
//// [/src/src-dogs/dog.d.ts]
145+
import { DogConfig } from 'src-types';
146+
export declare abstract class Dog {
147+
static getCapabilities(): DogConfig;
148+
}
144149

145-
error TS2318: Cannot find global type 'Function'.
146150

147-
error TS2318: Cannot find global type 'IArguments'.
151+
//// [/src/src-dogs/dog.js]
152+
import { DOG_CONFIG } from './dogconfig.js';
153+
export class Dog {
154+
static getCapabilities() {
155+
return DOG_CONFIG;
156+
}
157+
}
148158

149-
error TS2318: Cannot find global type 'Number'.
150159

151-
error TS2318: Cannot find global type 'Object'.
160+
//// [/src/src-dogs/dogconfig.d.ts]
161+
import { DogConfig } from 'src-types';
162+
export declare const DOG_CONFIG: DogConfig;
152163

153-
error TS2318: Cannot find global type 'RegExp'.
154164

155-
error TS2318: Cannot find global type 'String'.
165+
//// [/src/src-dogs/dogconfig.js]
166+
export const DOG_CONFIG = {
167+
name: 'Default dog',
168+
};
156169

157-
[12:00:27 AM] Project 'src/src-dogs/tsconfig.json' can't be built because its dependency 'src/src-types' has errors
158170

159-
[12:00:28 AM] Skipping build of project '/src/src-dogs/tsconfig.json' because its dependency '/src/src-types' has errors
171+
//// [/src/src-dogs/index.d.ts]
172+
export * from 'src-types';
173+
export * from './lassie/lassiedog.js';
160174

161175

162-
Found 9 errors.
176+
//// [/src/src-dogs/index.js]
177+
export * from 'src-types';
178+
export * from './lassie/lassiedog.js';
179+
180+
181+
//// [/src/src-dogs/lassie/lassieconfig.d.ts]
182+
import { DogConfig } from 'src-types';
183+
export declare const LASSIE_CONFIG: DogConfig;
184+
185+
186+
//// [/src/src-dogs/lassie/lassieconfig.js]
187+
export const LASSIE_CONFIG = { name: 'Lassie' };
188+
189+
190+
//// [/src/src-dogs/lassie/lassiedog.d.ts]
191+
import { Dog } from '../dog.js';
192+
export declare class LassieDog extends Dog {
193+
protected static getDogConfig: () => import("../index.js").DogConfig;
194+
}
195+
196+
197+
//// [/src/src-dogs/lassie/lassiedog.js]
198+
import { Dog } from '../dog.js';
199+
import { LASSIE_CONFIG } from './lassieconfig.js';
200+
export class LassieDog extends Dog {
201+
static getDogConfig = () => LASSIE_CONFIG;
202+
}
203+
204+
205+
//// [/src/src-dogs/tsconfig.tsbuildinfo]
206+
{"program":{"fileNames":["../../lib/lib.es2022.full.d.ts","../src-types/dogconfig.d.ts","../src-types/index.d.ts","./dogconfig.ts","./dog.ts","./lassie/lassieconfig.ts","./lassie/lassiedog.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-2632060142-export interface DogConfig {\r\n name: string;\r\n}\r\n","impliedFormat":99},{"version":"-5608794531-export * from './dogconfig.js';\r\n","impliedFormat":99},{"version":"1966273863-import { DogConfig } from 'src-types';\n\nexport const DOG_CONFIG: DogConfig = {\n name: 'Default dog',\n};\n","signature":"17588480778-import { DogConfig } from 'src-types';\r\nexport declare const DOG_CONFIG: DogConfig;\r\n","impliedFormat":99},{"version":"6091345804-import { DogConfig } from 'src-types';\nimport { DOG_CONFIG } from './dogconfig.js';\n\nexport abstract class Dog {\n\n public static getCapabilities(): DogConfig {\n return DOG_CONFIG;\n }\n}\n","signature":"22128633249-import { DogConfig } from 'src-types';\r\nexport declare abstract class Dog {\r\n static getCapabilities(): DogConfig;\r\n}\r\n","impliedFormat":99},{"version":"4440579024-import { DogConfig } from 'src-types';\n\nexport const LASSIE_CONFIG: DogConfig = { name: 'Lassie' };\n","signature":"8131483665-import { DogConfig } from 'src-types';\r\nexport declare const LASSIE_CONFIG: DogConfig;\r\n","impliedFormat":99},{"version":"-32303727812-import { Dog } from '../dog.js';\nimport { LASSIE_CONFIG } from './lassieconfig.js';\n\nexport class LassieDog extends Dog {\n protected static getDogConfig = () => LASSIE_CONFIG;\n}\n","signature":"-20244062422-import { Dog } from '../dog.js';\r\nexport declare class LassieDog extends Dog {\r\n protected static getDogConfig: () => import(\"../index.js\").DogConfig;\r\n}\r\n","impliedFormat":99},{"version":"-15974991320-export * from 'src-types';\nexport * from './lassie/lassiedog.js';\n","signature":"-16783836862-export * from 'src-types';\r\nexport * from './lassie/lassiedog.js';\r\n","impliedFormat":99}],"options":{"composite":true,"declaration":true,"module":100},"fileIdsList":[[3,4],[3],[3,7],[5,6],[2],[5,8]],"referencedMap":[[5,1],[4,2],[8,3],[6,2],[7,4],[3,5]],"exportedModulesMap":[[5,2],[4,2],[8,3],[6,2],[7,6],[3,5]],"semanticDiagnosticsPerFile":[1,5,4,8,6,7,2,3]},"version":"FakeTSVersion"}
207+
208+
//// [/src/src-dogs/tsconfig.tsbuildinfo.readable.baseline.txt]
209+
{
210+
"program": {
211+
"fileNames": [
212+
"../../lib/lib.es2022.full.d.ts",
213+
"../src-types/dogconfig.d.ts",
214+
"../src-types/index.d.ts",
215+
"./dogconfig.ts",
216+
"./dog.ts",
217+
"./lassie/lassieconfig.ts",
218+
"./lassie/lassiedog.ts",
219+
"./index.ts"
220+
],
221+
"fileNamesList": [
222+
[
223+
"../src-types/index.d.ts",
224+
"./dogconfig.ts"
225+
],
226+
[
227+
"../src-types/index.d.ts"
228+
],
229+
[
230+
"../src-types/index.d.ts",
231+
"./lassie/lassiedog.ts"
232+
],
233+
[
234+
"./dog.ts",
235+
"./lassie/lassieconfig.ts"
236+
],
237+
[
238+
"../src-types/dogconfig.d.ts"
239+
],
240+
[
241+
"./dog.ts",
242+
"./index.ts"
243+
]
244+
],
245+
"fileInfos": {
246+
"../../lib/lib.es2022.full.d.ts": {
247+
"version": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
248+
"signature": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
249+
"affectsGlobalScope": true,
250+
"impliedFormat": 1
251+
},
252+
"../src-types/dogconfig.d.ts": {
253+
"version": "-2632060142-export interface DogConfig {\r\n name: string;\r\n}\r\n",
254+
"signature": "-2632060142-export interface DogConfig {\r\n name: string;\r\n}\r\n",
255+
"impliedFormat": 99
256+
},
257+
"../src-types/index.d.ts": {
258+
"version": "-5608794531-export * from './dogconfig.js';\r\n",
259+
"signature": "-5608794531-export * from './dogconfig.js';\r\n",
260+
"impliedFormat": 99
261+
},
262+
"./dogconfig.ts": {
263+
"version": "1966273863-import { DogConfig } from 'src-types';\n\nexport const DOG_CONFIG: DogConfig = {\n name: 'Default dog',\n};\n",
264+
"signature": "17588480778-import { DogConfig } from 'src-types';\r\nexport declare const DOG_CONFIG: DogConfig;\r\n",
265+
"impliedFormat": 99
266+
},
267+
"./dog.ts": {
268+
"version": "6091345804-import { DogConfig } from 'src-types';\nimport { DOG_CONFIG } from './dogconfig.js';\n\nexport abstract class Dog {\n\n public static getCapabilities(): DogConfig {\n return DOG_CONFIG;\n }\n}\n",
269+
"signature": "22128633249-import { DogConfig } from 'src-types';\r\nexport declare abstract class Dog {\r\n static getCapabilities(): DogConfig;\r\n}\r\n",
270+
"impliedFormat": 99
271+
},
272+
"./lassie/lassieconfig.ts": {
273+
"version": "4440579024-import { DogConfig } from 'src-types';\n\nexport const LASSIE_CONFIG: DogConfig = { name: 'Lassie' };\n",
274+
"signature": "8131483665-import { DogConfig } from 'src-types';\r\nexport declare const LASSIE_CONFIG: DogConfig;\r\n",
275+
"impliedFormat": 99
276+
},
277+
"./lassie/lassiedog.ts": {
278+
"version": "-32303727812-import { Dog } from '../dog.js';\nimport { LASSIE_CONFIG } from './lassieconfig.js';\n\nexport class LassieDog extends Dog {\n protected static getDogConfig = () => LASSIE_CONFIG;\n}\n",
279+
"signature": "-20244062422-import { Dog } from '../dog.js';\r\nexport declare class LassieDog extends Dog {\r\n protected static getDogConfig: () => import(\"../index.js\").DogConfig;\r\n}\r\n",
280+
"impliedFormat": 99
281+
},
282+
"./index.ts": {
283+
"version": "-15974991320-export * from 'src-types';\nexport * from './lassie/lassiedog.js';\n",
284+
"signature": "-16783836862-export * from 'src-types';\r\nexport * from './lassie/lassiedog.js';\r\n",
285+
"impliedFormat": 99
286+
}
287+
},
288+
"options": {
289+
"composite": true,
290+
"declaration": true,
291+
"module": 100
292+
},
293+
"referencedMap": {
294+
"./dog.ts": [
295+
"../src-types/index.d.ts",
296+
"./dogconfig.ts"
297+
],
298+
"./dogconfig.ts": [
299+
"../src-types/index.d.ts"
300+
],
301+
"./index.ts": [
302+
"../src-types/index.d.ts",
303+
"./lassie/lassiedog.ts"
304+
],
305+
"./lassie/lassieconfig.ts": [
306+
"../src-types/index.d.ts"
307+
],
308+
"./lassie/lassiedog.ts": [
309+
"./dog.ts",
310+
"./lassie/lassieconfig.ts"
311+
],
312+
"../src-types/index.d.ts": [
313+
"../src-types/dogconfig.d.ts"
314+
]
315+
},
316+
"exportedModulesMap": {
317+
"./dog.ts": [
318+
"../src-types/index.d.ts"
319+
],
320+
"./dogconfig.ts": [
321+
"../src-types/index.d.ts"
322+
],
323+
"./index.ts": [
324+
"../src-types/index.d.ts",
325+
"./lassie/lassiedog.ts"
326+
],
327+
"./lassie/lassieconfig.ts": [
328+
"../src-types/index.d.ts"
329+
],
330+
"./lassie/lassiedog.ts": [
331+
"./dog.ts",
332+
"./index.ts"
333+
],
334+
"../src-types/index.d.ts": [
335+
"../src-types/dogconfig.d.ts"
336+
]
337+
},
338+
"semanticDiagnosticsPerFile": [
339+
"../../lib/lib.es2022.full.d.ts",
340+
"./dog.ts",
341+
"./dogconfig.ts",
342+
"./index.ts",
343+
"./lassie/lassieconfig.ts",
344+
"./lassie/lassiedog.ts",
345+
"../src-types/dogconfig.d.ts",
346+
"../src-types/index.d.ts"
347+
]
348+
},
349+
"version": "FakeTSVersion",
350+
"size": 2712
351+
}
352+
353+
//// [/src/src-types/dogconfig.d.ts]
354+
export interface DogConfig {
355+
name: string;
356+
}
357+
358+
359+
//// [/src/src-types/dogconfig.js]
360+
export {};
361+
362+
363+
//// [/src/src-types/index.d.ts]
364+
export * from './dogconfig.js';
365+
366+
367+
//// [/src/src-types/index.js]
368+
export * from './dogconfig.js';
369+
370+
371+
//// [/src/src-types/tsconfig.tsbuildinfo]
372+
{"program":{"fileNames":["../../lib/lib.es2022.full.d.ts","./dogconfig.ts","./index.ts"],"fileInfos":[{"version":"-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }","affectsGlobalScope":true,"impliedFormat":1},{"version":"-5575793279-export interface DogConfig {\n name: string;\n}","signature":"-2632060142-export interface DogConfig {\r\n name: string;\r\n}\r\n","impliedFormat":99},{"version":"-6189272282-export * from './dogconfig.js';","signature":"-5608794531-export * from './dogconfig.js';\r\n","impliedFormat":99}],"options":{"composite":true,"declaration":true,"module":100},"fileIdsList":[[2]],"referencedMap":[[3,1]],"exportedModulesMap":[[3,1]],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"}
373+
374+
//// [/src/src-types/tsconfig.tsbuildinfo.readable.baseline.txt]
375+
{
376+
"program": {
377+
"fileNames": [
378+
"../../lib/lib.es2022.full.d.ts",
379+
"./dogconfig.ts",
380+
"./index.ts"
381+
],
382+
"fileNamesList": [
383+
[
384+
"./dogconfig.ts"
385+
]
386+
],
387+
"fileInfos": {
388+
"../../lib/lib.es2022.full.d.ts": {
389+
"version": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
390+
"signature": "-7698705165-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }",
391+
"affectsGlobalScope": true,
392+
"impliedFormat": 1
393+
},
394+
"./dogconfig.ts": {
395+
"version": "-5575793279-export interface DogConfig {\n name: string;\n}",
396+
"signature": "-2632060142-export interface DogConfig {\r\n name: string;\r\n}\r\n",
397+
"impliedFormat": 99
398+
},
399+
"./index.ts": {
400+
"version": "-6189272282-export * from './dogconfig.js';",
401+
"signature": "-5608794531-export * from './dogconfig.js';\r\n",
402+
"impliedFormat": 99
403+
}
404+
},
405+
"options": {
406+
"composite": true,
407+
"declaration": true,
408+
"module": 100
409+
},
410+
"referencedMap": {
411+
"./index.ts": [
412+
"./dogconfig.ts"
413+
]
414+
},
415+
"exportedModulesMap": {
416+
"./index.ts": [
417+
"./dogconfig.ts"
418+
]
419+
},
420+
"semanticDiagnosticsPerFile": [
421+
"../../lib/lib.es2022.full.d.ts",
422+
"./dogconfig.ts",
423+
"./index.ts"
424+
]
425+
},
426+
"version": "FakeTSVersion",
427+
"size": 1038
428+
}
163429

164-
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
165-
166-

0 commit comments

Comments
 (0)