mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 20:37:46 -05:00
Fixes missing error exit code when a bogus input file is specified
Fixes #33849.
This commit is contained in:
@@ -39,17 +39,19 @@ namespace ts {
|
||||
|
||||
interface VerifyBuild {
|
||||
modifyDiskLayout: (fs: vfs.FileSystem) => void;
|
||||
tsconfigs?: readonly string[];
|
||||
expectedExitStatus: ExitStatus;
|
||||
expectedDiagnostics: (fs: vfs.FileSystem) => fakes.ExpectedDiagnostic[];
|
||||
expectedOutputs: readonly string[];
|
||||
notExpectedOutputs: readonly string[];
|
||||
}
|
||||
|
||||
function verifyBuild({ modifyDiskLayout, expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs }: VerifyBuild) {
|
||||
function verifyBuild({ modifyDiskLayout, tsconfigs = ["/src/tsconfig.json"],
|
||||
expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs }: VerifyBuild) {
|
||||
const fs = projFs.shadow();
|
||||
const host = fakes.SolutionBuilderHost.create(fs);
|
||||
modifyDiskLayout(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], { verbose: true });
|
||||
const builder = createSolutionBuilder(host, tsconfigs, { verbose: true });
|
||||
const exitStatus = builder.build();
|
||||
assert.equal(exitStatus, expectedExitStatus);
|
||||
host.assertDiagnosticMessages(...expectedDiagnostics(fs));
|
||||
@@ -156,5 +158,19 @@ namespace ts {
|
||||
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
|
||||
});
|
||||
});
|
||||
|
||||
it("returns an error exit in case of a bogus file", () => {
|
||||
verifyBuild({
|
||||
modifyDiskLayout: noop,
|
||||
tsconfigs: ["bogus.json"],
|
||||
expectedExitStatus: ExitStatus.DiagnosticsPresent_OutputsSkipped,
|
||||
expectedDiagnostics: _ => [
|
||||
getExpectedDiagnosticForProjectsInBuild("bogus.json"),
|
||||
errorDiagnostic([Diagnostics.File_0_not_found, "/bogus.json"]),
|
||||
],
|
||||
expectedOutputs: emptyArray,
|
||||
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user