-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Handle seenEmittedFiles which was not being set when emit of a file was complete #33145
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e269e70
Add test that fails because file is written multiple times
sheetalkamat 3599727
Handle seenEmittedFiles which was not being set when emit of a file w…
sheetalkamat 1b6b39c
make baselining source map optional
sheetalkamat d0a57ab
Handle emitDeclarationOnly in --build scenario
sheetalkamat f3f2280
Ensure we are using d.ts emit as signature even when --declarationMap…
sheetalkamat b39e34f
Move module specifiers to verifyTsBuildOutput
sheetalkamat 6587bd7
implement create Hash to be default hashing plus data so we can verif…
sheetalkamat 1fc6b2b
Remove failing baseline
sheetalkamat 83cac57
Accept correct baseline name
sheetalkamat e7a4e8c
Merge branch 'master' into builderCircularity
sheetalkamat 9c1a352
Merge branch 'master' into builderCircularity
sheetalkamat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
109 changes: 109 additions & 0 deletions
109
src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts
This file contains hidden or 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,109 @@ | ||
namespace ts { | ||
describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { | ||
let projFs: vfs.FileSystem; | ||
const { time, tick } = getTime(); | ||
before(() => { | ||
projFs = loadProjectFromDisk("tests/projects/emitDeclarationOnly", time); | ||
}); | ||
after(() => { | ||
projFs = undefined!; | ||
}); | ||
|
||
function verifyEmitDeclarationOnly(disableMap?: true) { | ||
verifyTsbuildOutput({ | ||
scenario: `only dts output in circular import project with emitDeclarationOnly${disableMap ? "" : " and declarationMap"}`, | ||
projFs: () => projFs, | ||
time, | ||
tick, | ||
proj: "emitDeclarationOnly", | ||
rootNames: ["/src"], | ||
lastProjectOutput: `/src/lib/index.d.ts`, | ||
outputFiles: [ | ||
"/src/lib/a.d.ts", | ||
"/src/lib/b.d.ts", | ||
"/src/lib/c.d.ts", | ||
"/src/lib/index.d.ts", | ||
"/src/tsconfig.tsbuildinfo", | ||
...(disableMap ? emptyArray : [ | ||
"/src/lib/a.d.ts.map", | ||
"/src/lib/b.d.ts.map", | ||
"/src/lib/c.d.ts.map", | ||
"/src/lib/index.d.ts.map" | ||
]) | ||
], | ||
initialBuild: { | ||
modifyFs: disableMap ? | ||
(fs => replaceText(fs, "/src/tsconfig.json", `"declarationMap": true,`, "")) : | ||
noop, | ||
expectedDiagnostics: [ | ||
getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), | ||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/lib/a.d.ts"], | ||
[Diagnostics.Building_project_0, "/src/tsconfig.json"] | ||
] | ||
}, | ||
incrementalDtsChangedBuild: { | ||
modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), | ||
expectedDiagnostics: [ | ||
getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), | ||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], | ||
[Diagnostics.Building_project_0, "/src/tsconfig.json"] | ||
] | ||
}, | ||
baselineOnly: true, | ||
verifyDiagnostics: true | ||
}); | ||
} | ||
verifyEmitDeclarationOnly(); | ||
verifyEmitDeclarationOnly(/*disableMap*/ true); | ||
|
||
verifyTsbuildOutput({ | ||
scenario: `only dts output in non circular imports project with emitDeclarationOnly`, | ||
projFs: () => projFs, | ||
time, | ||
tick, | ||
proj: "emitDeclarationOnly", | ||
rootNames: ["/src"], | ||
lastProjectOutput: `/src/lib/a.d.ts`, | ||
outputFiles: [ | ||
"/src/lib/a.d.ts", | ||
"/src/lib/b.d.ts", | ||
"/src/lib/c.d.ts", | ||
"/src/tsconfig.tsbuildinfo", | ||
"/src/lib/a.d.ts.map", | ||
"/src/lib/b.d.ts.map", | ||
"/src/lib/c.d.ts.map", | ||
], | ||
initialBuild: { | ||
modifyFs: fs => { | ||
fs.rimrafSync("/src/src/index.ts"); | ||
replaceText(fs, "/src/src/a.ts", `import { B } from "./b";`, `export class B { prop = "hello"; }`); | ||
}, | ||
expectedDiagnostics: [ | ||
getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), | ||
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tsconfig.json", "src/lib/a.d.ts"], | ||
[Diagnostics.Building_project_0, "/src/tsconfig.json"] | ||
] | ||
}, | ||
incrementalDtsChangedBuild: { | ||
modifyFs: fs => replaceText(fs, "/src/src/a.ts", "b: B;", "b: B; foo: any;"), | ||
expectedDiagnostics: [ | ||
getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), | ||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], | ||
[Diagnostics.Building_project_0, "/src/tsconfig.json"] | ||
] | ||
}, | ||
incrementalDtsUnchangedBuild: { | ||
modifyFs: fs => replaceText(fs, "/src/src/a.ts", "export interface A {", `class C { } | ||
export interface A {`), | ||
expectedDiagnostics: [ | ||
getExpectedDiagnosticForProjectsInBuild("src/tsconfig.json"), | ||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tsconfig.json", "src/lib/a.d.ts", "src/src/a.ts"], | ||
[Diagnostics.Building_project_0, "/src/tsconfig.json"], | ||
[Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/tsconfig.json"] | ||
] | ||
}, | ||
baselineOnly: true, | ||
verifyDiagnostics: true | ||
}); | ||
}); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick note for @weswigham: this new line will probably need when bringing the js-to-dts PR up to date with master