Skip to content

Use typescript.d.ts in APISample tests #51061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/harness/harnessIO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ namespace Harness {
}

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

export type SourceMapEmitterCallback = (
emittedFile: string,
Expand Down
7 changes: 4 additions & 3 deletions tests/baselines/reference/APISample_Watch.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_Watch.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

//// [APISample_Watch.ts]
Expand Down
7 changes: 4 additions & 3 deletions tests/baselines/reference/APISample_WatchWithDefaults.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_WatchWithDefaults.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

//// [APISample_WatchWithDefaults.ts]
Expand Down
7 changes: 4 additions & 3 deletions tests/baselines/reference/APISample_WatchWithOwnWatchHost.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

//// [APISample_WatchWithOwnWatchHost.ts]
Expand Down
7 changes: 4 additions & 3 deletions tests/baselines/reference/APISample_compile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_compile.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

//// [APISample_compile.ts]
Expand Down
7 changes: 4 additions & 3 deletions tests/baselines/reference/APISample_jsdoc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_jsdoc.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

//// [APISample_jsdoc.ts]
Expand Down
10 changes: 6 additions & 4 deletions tests/baselines/reference/APISample_linter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_linter.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

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

// delint it
delint(sourceFile);
});
});


//// [APISample_linter.js]
"use strict";
Expand Down
10 changes: 6 additions & 4 deletions tests/baselines/reference/APISample_parseConfig.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_parseConfig.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

//// [APISample_parseConfig.ts]
Expand Down Expand Up @@ -40,7 +41,8 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string):
return undefined;
}
return ts.createProgram(rootFiles, settings.options);
}
}


//// [APISample_parseConfig.js]
"use strict";
Expand Down
10 changes: 6 additions & 4 deletions tests/baselines/reference/APISample_transform.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_transform.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

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

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

console.log(JSON.stringify(result));
console.log(JSON.stringify(result));


//// [APISample_transform.js]
"use strict";
Expand Down
7 changes: 4 additions & 3 deletions tests/baselines/reference/APISample_watcher.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//// [tests/cases/compiler/APISample_watcher.ts] ////

//// [index.d.ts]
declare module "typescript" {
export = ts;
//// [package.json]
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

//// [APISample_watcher.ts]
Expand Down
8 changes: 4 additions & 4 deletions tests/cases/compiler/APISample_Watch.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_Watch.ts
Expand Down
8 changes: 4 additions & 4 deletions tests/cases/compiler/APISample_WatchWithDefaults.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_WatchWithDefaults.ts
Expand Down
8 changes: 4 additions & 4 deletions tests/cases/compiler/APISample_WatchWithOwnWatchHost.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_WatchWithOwnWatchHost.ts
Expand Down
8 changes: 4 additions & 4 deletions tests/cases/compiler/APISample_compile.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_compile.ts
Expand Down
8 changes: 4 additions & 4 deletions tests/cases/compiler/APISample_jsdoc.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_jsdoc.ts
Expand Down
10 changes: 5 additions & 5 deletions tests/cases/compiler/APISample_linter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_linter.ts
Expand Down Expand Up @@ -72,4 +72,4 @@ fileNames.forEach(fileName => {

// delint it
delint(sourceFile);
});
});
10 changes: 5 additions & 5 deletions tests/cases/compiler/APISample_parseConfig.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_parseConfig.ts
Expand Down Expand Up @@ -44,4 +44,4 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string):
return undefined;
}
return ts.createProgram(rootFiles, settings.options);
}
}
10 changes: 5 additions & 5 deletions tests/cases/compiler/APISample_transform.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

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

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

console.log(JSON.stringify(result));
console.log(JSON.stringify(result));
8 changes: 4 additions & 4 deletions tests/cases/compiler/APISample_watcher.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @module: commonjs
// @skipLibCheck: true
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true

// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
// @filename: node_modules/typescript/package.json
{
"name": "typescript",
"types": "/.ts/typescript.d.ts"
}

// @filename: APISample_watcher.ts
Expand Down