-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Baseline showing #41801 and other issues with output path calculation
- Loading branch information
1 parent
387b6dc
commit ff03ed0
Showing
7 changed files
with
577 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
namespace ts { | ||
describe("unittests:: tsbuild - output file paths", () => { | ||
const incrementalScenarios: TscIncremental[] = [ | ||
noChangeRun, | ||
{ | ||
buildKind: BuildKind.NoChangeRun, | ||
modifyFs: noop, | ||
subScenario: "Normal build without change, that does not block emit on error to show files that get emitted", | ||
commandLineArgs: ["-p", "/src/tsconfig.json"], | ||
} | ||
]; | ||
|
||
verifyTscSerializedIncrementalEdits({ | ||
scenario: "outputPaths", | ||
subScenario: "when rootDir is not specified", | ||
fs: () => loadProjectFromFiles({ | ||
"/src/src/index.ts": "export const x = 10;", | ||
"/src/tsconfig.json": JSON.stringify({ | ||
compilerOptions: { | ||
outDir: "dist" | ||
} | ||
}) | ||
}), | ||
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"], | ||
incrementalScenarios, | ||
}); | ||
|
||
verifyTscSerializedIncrementalEdits({ | ||
scenario: "outputPaths", | ||
subScenario: "when rootDir is not specified and is composite", | ||
fs: () => loadProjectFromFiles({ | ||
"/src/src/index.ts": "export const x = 10;", | ||
"/src/tsconfig.json": JSON.stringify({ | ||
compilerOptions: { | ||
outDir: "dist", | ||
composite: true | ||
} | ||
}) | ||
}), | ||
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"], | ||
incrementalScenarios, | ||
}); | ||
|
||
verifyTscSerializedIncrementalEdits({ | ||
scenario: "outputPaths", | ||
subScenario: "when rootDir is specified", | ||
fs: () => loadProjectFromFiles({ | ||
"/src/src/index.ts": "export const x = 10;", | ||
"/src/tsconfig.json": JSON.stringify({ | ||
compilerOptions: { | ||
outDir: "dist", | ||
rootDir: "src" | ||
} | ||
}) | ||
}), | ||
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"], | ||
incrementalScenarios, | ||
}); | ||
|
||
verifyTscSerializedIncrementalEdits({ | ||
scenario: "outputPaths", | ||
subScenario: "when rootDir is specified but not all files belong to rootDir", | ||
fs: () => loadProjectFromFiles({ | ||
"/src/src/index.ts": "export const x = 10;", | ||
"/src/types/type.ts": "export type t = string;", | ||
"/src/tsconfig.json": JSON.stringify({ | ||
compilerOptions: { | ||
outDir: "dist", | ||
rootDir: "src" | ||
} | ||
}) | ||
}), | ||
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"], | ||
incrementalScenarios, | ||
}); | ||
|
||
verifyTscSerializedIncrementalEdits({ | ||
scenario: "outputPaths", | ||
subScenario: "when rootDir is specified but not all files belong to rootDir and is composite", | ||
fs: () => loadProjectFromFiles({ | ||
"/src/src/index.ts": "export const x = 10;", | ||
"/src/types/type.ts": "export type t = string;", | ||
"/src/tsconfig.json": JSON.stringify({ | ||
compilerOptions: { | ||
outDir: "dist", | ||
rootDir: "src", | ||
composite: true | ||
} | ||
}) | ||
}), | ||
commandLineArgs: ["--b", "/src/tsconfig.json", "-v"], | ||
incrementalScenarios, | ||
}); | ||
}); | ||
} |
104 changes: 104 additions & 0 deletions
104
...rence/tsbuild/outputPaths/initial-build/when-rootDir-is-not-specified-and-is-composite.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
Input:: | ||
//// [/lib/lib.d.ts] | ||
/// <reference no-default-lib="true"/> | ||
interface Boolean {} | ||
interface Function {} | ||
interface CallableFunction {} | ||
interface NewableFunction {} | ||
interface IArguments {} | ||
interface Number { toExponential: any; } | ||
interface Object {} | ||
interface RegExp {} | ||
interface String { charAt: any; } | ||
interface Array<T> { length: number; [n: number]: T; } | ||
interface ReadonlyArray<T> {} | ||
declare const console: { log(msg: any): void; }; | ||
|
||
//// [/src/src/index.ts] | ||
export const x = 10; | ||
|
||
//// [/src/tsconfig.json] | ||
{"compilerOptions":{"outDir":"dist","composite":true}} | ||
|
||
|
||
|
||
Output:: | ||
/lib/tsc --b /src/tsconfig.json -v | ||
[[90m12:01:00 AM[0m] Projects in this build: | ||
* src/tsconfig.json | ||
|
||
[[90m12:01:00 AM[0m] Project 'src/tsconfig.json' is out of date because output file 'src/dist/src/index.js' does not exist | ||
|
||
[[90m12:01:00 AM[0m] Building project '/src/tsconfig.json'... | ||
|
||
exitCode:: ExitStatus.Success | ||
|
||
|
||
//// [/src/dist/src/index.d.ts] | ||
export declare const x = 10; | ||
|
||
|
||
//// [/src/dist/src/index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.x = void 0; | ||
exports.x = 10; | ||
|
||
|
||
//// [/src/dist/tsconfig.tsbuildinfo] | ||
{ | ||
"program": { | ||
"fileInfos": { | ||
"../../lib/lib.d.ts": { | ||
"version": "3858781397-/// <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; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };", | ||
"signature": "3858781397-/// <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; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };", | ||
"affectsGlobalScope": true | ||
}, | ||
"../src/index.ts": { | ||
"version": "-10726455937-export const x = 10;", | ||
"signature": "-6057683066-export declare const x = 10;\r\n", | ||
"affectsGlobalScope": false | ||
} | ||
}, | ||
"options": { | ||
"outDir": "./", | ||
"composite": true, | ||
"configFilePath": "../tsconfig.json" | ||
}, | ||
"referencedMap": {}, | ||
"exportedModulesMap": {}, | ||
"semanticDiagnosticsPerFile": [ | ||
"../../lib/lib.d.ts", | ||
"../src/index.ts" | ||
] | ||
}, | ||
"version": "FakeTSVersion" | ||
} | ||
|
||
|
||
|
||
Change:: no-change-run | ||
Input:: | ||
|
||
|
||
Output:: | ||
/lib/tsc --b /src/tsconfig.json -v | ||
[[90m12:04:00 AM[0m] Projects in this build: | ||
* src/tsconfig.json | ||
|
||
[[90m12:04:00 AM[0m] Project 'src/tsconfig.json' is up to date because newest input 'src/src/index.ts' is older than oldest output 'src/dist/src/index.js' | ||
|
||
exitCode:: ExitStatus.Success | ||
|
||
|
||
|
||
|
||
Change:: Normal build without change, that does not block emit on error to show files that get emitted | ||
Input:: | ||
|
||
|
||
Output:: | ||
/lib/tsc -p /src/tsconfig.json | ||
exitCode:: ExitStatus.Success | ||
|
||
|
74 changes: 74 additions & 0 deletions
74
tests/baselines/reference/tsbuild/outputPaths/initial-build/when-rootDir-is-not-specified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Input:: | ||
//// [/lib/lib.d.ts] | ||
/// <reference no-default-lib="true"/> | ||
interface Boolean {} | ||
interface Function {} | ||
interface CallableFunction {} | ||
interface NewableFunction {} | ||
interface IArguments {} | ||
interface Number { toExponential: any; } | ||
interface Object {} | ||
interface RegExp {} | ||
interface String { charAt: any; } | ||
interface Array<T> { length: number; [n: number]: T; } | ||
interface ReadonlyArray<T> {} | ||
declare const console: { log(msg: any): void; }; | ||
|
||
//// [/src/src/index.ts] | ||
export const x = 10; | ||
|
||
//// [/src/tsconfig.json] | ||
{"compilerOptions":{"outDir":"dist"}} | ||
|
||
|
||
|
||
Output:: | ||
/lib/tsc --b /src/tsconfig.json -v | ||
[[90m12:01:00 AM[0m] Projects in this build: | ||
* src/tsconfig.json | ||
|
||
[[90m12:01:00 AM[0m] Project 'src/tsconfig.json' is out of date because output file 'src/dist/src/index.js' does not exist | ||
|
||
[[90m12:01:00 AM[0m] Building project '/src/tsconfig.json'... | ||
|
||
exitCode:: ExitStatus.Success | ||
|
||
|
||
//// [/src/dist/index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.x = void 0; | ||
exports.x = 10; | ||
|
||
|
||
|
||
|
||
Change:: no-change-run | ||
Input:: | ||
|
||
|
||
Output:: | ||
/lib/tsc --b /src/tsconfig.json -v | ||
[[90m12:04:00 AM[0m] Projects in this build: | ||
* src/tsconfig.json | ||
|
||
[[90m12:04:00 AM[0m] Project 'src/tsconfig.json' is out of date because output file 'src/dist/src/index.js' does not exist | ||
|
||
[[90m12:04:00 AM[0m] Building project '/src/tsconfig.json'... | ||
|
||
exitCode:: ExitStatus.Success | ||
|
||
|
||
//// [/src/dist/index.js] file written with same contents | ||
|
||
|
||
Change:: Normal build without change, that does not block emit on error to show files that get emitted | ||
Input:: | ||
|
||
|
||
Output:: | ||
/lib/tsc -p /src/tsconfig.json | ||
exitCode:: ExitStatus.Success | ||
|
||
|
||
//// [/src/dist/index.js] file written with same contents |
Oops, something went wrong.