Skip to content

Commit 8af9a93

Browse files
authoredOct 4, 2022
Use typescript.d.ts in APISample tests (#51061)
1 parent 4953316 commit 8af9a93

19 files changed

+81
-71
lines changed
 

‎src/harness/harnessIO.ts

-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ namespace Harness {
177177
}
178178

179179
export const libFolder = "built/local/";
180-
const tcServicesFileName = ts.combinePaths(libFolder, "typescriptServices.js");
181-
export const tcServicesFile = IO.readFile(tcServicesFileName) + IO.newLine() + `//# sourceURL=${IO.resolvePath(tcServicesFileName)}`;
182180

183181
export type SourceMapEmitterCallback = (
184182
emittedFile: string,

‎tests/baselines/reference/APISample_Watch.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_Watch.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_Watch.ts]

‎tests/baselines/reference/APISample_WatchWithDefaults.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_WatchWithDefaults.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_WatchWithDefaults.ts]

‎tests/baselines/reference/APISample_WatchWithOwnWatchHost.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_WatchWithOwnWatchHost.ts]

‎tests/baselines/reference/APISample_compile.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_compile.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_compile.ts]

‎tests/baselines/reference/APISample_jsdoc.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_jsdoc.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_jsdoc.ts]

‎tests/baselines/reference/APISample_linter.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_linter.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_linter.ts]
@@ -68,7 +69,8 @@ fileNames.forEach(fileName => {
6869

6970
// delint it
7071
delint(sourceFile);
71-
});
72+
});
73+
7274

7375
//// [APISample_linter.js]
7476
"use strict";

‎tests/baselines/reference/APISample_parseConfig.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_parseConfig.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_parseConfig.ts]
@@ -40,7 +41,8 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string):
4041
return undefined;
4142
}
4243
return ts.createProgram(rootFiles, settings.options);
43-
}
44+
}
45+
4446

4547
//// [APISample_parseConfig.js]
4648
"use strict";

‎tests/baselines/reference/APISample_transform.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_transform.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_transform.ts]
@@ -20,7 +21,8 @@ const source = "let x: string = 'string'";
2021

2122
let result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
2223

23-
console.log(JSON.stringify(result));
24+
console.log(JSON.stringify(result));
25+
2426

2527
//// [APISample_transform.js]
2628
"use strict";

‎tests/baselines/reference/APISample_watcher.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//// [tests/cases/compiler/APISample_watcher.ts] ////
22

3-
//// [index.d.ts]
4-
declare module "typescript" {
5-
export = ts;
3+
//// [package.json]
4+
{
5+
"name": "typescript",
6+
"types": "/.ts/typescript.d.ts"
67
}
78

89
//// [APISample_watcher.ts]

‎tests/cases/compiler/APISample_Watch.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_Watch.ts

‎tests/cases/compiler/APISample_WatchWithDefaults.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_WatchWithDefaults.ts

‎tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_WatchWithOwnWatchHost.ts

‎tests/cases/compiler/APISample_compile.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_compile.ts

‎tests/cases/compiler/APISample_jsdoc.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_jsdoc.ts

‎tests/cases/compiler/APISample_linter.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_linter.ts
@@ -72,4 +72,4 @@ fileNames.forEach(fileName => {
7272

7373
// delint it
7474
delint(sourceFile);
75-
});
75+
});

‎tests/cases/compiler/APISample_parseConfig.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_parseConfig.ts
@@ -44,4 +44,4 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string):
4444
return undefined;
4545
}
4646
return ts.createProgram(rootFiles, settings.options);
47-
}
47+
}

‎tests/cases/compiler/APISample_transform.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_transform.ts
@@ -24,4 +24,4 @@ const source = "let x: string = 'string'";
2424

2525
let result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
2626

27-
console.log(JSON.stringify(result));
27+
console.log(JSON.stringify(result));

‎tests/cases/compiler/APISample_watcher.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @module: commonjs
22
// @skipLibCheck: true
3-
// @includebuiltfile: typescriptServices.d.ts
43
// @noImplicitAny:true
54
// @strictNullChecks:true
65

7-
// @filename: node_modules/typescript/index.d.ts
8-
declare module "typescript" {
9-
export = ts;
6+
// @filename: node_modules/typescript/package.json
7+
{
8+
"name": "typescript",
9+
"types": "/.ts/typescript.d.ts"
1010
}
1111

1212
// @filename: APISample_watcher.ts

0 commit comments

Comments
 (0)
Please sign in to comment.