Skip to content

Commit 15a0f57

Browse files
author
Josh Goldberg
authored
Added explicit error for TSLint not being found (#837)
1 parent fd1aedf commit 15a0f57

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/input/findTSLintConfiguration.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ export type FindTSLintConfigurationDependencies = {
1919
};
2020

2121
const knownErrors = [
22+
[
23+
"command not found",
24+
() =>
25+
new Error(
26+
"The 'tslint' command was not found. Either install it globally or add it as a devDependency of this repository.",
27+
),
28+
],
2229
[
2330
"unknown option `--print-config",
2431
() => new Error("TSLint v5.18 required. Please update your version."),

src/input/findTslintConfiguration.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ describe("findTSLintConfiguration", () => {
4949
);
5050
});
5151

52+
it("replaces an error with a v5.18 request when the tslint command is not found", async () => {
53+
// Arrange
54+
const stderr = "/bin/sh tslint: command not found";
55+
const dependencies = createStubDependencies({
56+
exec: createStubThrowingExec({ stderr }),
57+
});
58+
59+
// Act
60+
const result = await findTSLintConfiguration(dependencies, undefined);
61+
62+
// Assert
63+
expect(result).toEqual(
64+
expect.objectContaining({
65+
message:
66+
"The 'tslint' command was not found. Either install it globally or add it as a devDependency of this repository.",
67+
}),
68+
);
69+
});
70+
5271
it("replaces an error with a v5.18 request when the --print-config option is unsupported", async () => {
5372
// Arrange
5473
const stderr = "unknown option `--print-config";

0 commit comments

Comments
 (0)