diff --git a/src/input/findTSLintConfiguration.ts b/src/input/findTSLintConfiguration.ts index 24e3d52a9..b39240f50 100644 --- a/src/input/findTSLintConfiguration.ts +++ b/src/input/findTSLintConfiguration.ts @@ -19,6 +19,13 @@ export type FindTSLintConfigurationDependencies = { }; const knownErrors = [ + [ + "command not found", + () => + new Error( + "The 'tslint' command was not found. Either install it globally or add it as a devDependency of this repository.", + ), + ], [ "unknown option `--print-config", () => new Error("TSLint v5.18 required. Please update your version."), diff --git a/src/input/findTslintConfiguration.test.ts b/src/input/findTslintConfiguration.test.ts index cf0e9b4f9..fd6958614 100644 --- a/src/input/findTslintConfiguration.test.ts +++ b/src/input/findTslintConfiguration.test.ts @@ -49,6 +49,25 @@ describe("findTSLintConfiguration", () => { ); }); + it("replaces an error with a v5.18 request when the tslint command is not found", async () => { + // Arrange + const stderr = "/bin/sh tslint: command not found"; + const dependencies = createStubDependencies({ + exec: createStubThrowingExec({ stderr }), + }); + + // Act + const result = await findTSLintConfiguration(dependencies, undefined); + + // Assert + expect(result).toEqual( + expect.objectContaining({ + message: + "The 'tslint' command was not found. Either install it globally or add it as a devDependency of this repository.", + }), + ); + }); + it("replaces an error with a v5.18 request when the --print-config option is unsupported", async () => { // Arrange const stderr = "unknown option `--print-config";