Skip to content

Commit

Permalink
Add test cases from palantir#2765
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-hanson committed May 19, 2017
1 parent b3f8225 commit c980298
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/configurationTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import * as path from "path";
import {
convertRuleOptions,
extendConfigurationFile,
findConfigurationPath,
IConfigurationFile,
loadConfigurationFromPath,
parseConfigFile,
Expand Down Expand Up @@ -194,6 +195,23 @@ describe("Configuration", () => {
});
});

describe("findConfigurationPath", () => {
it("finds the closest tslint.json", () => {
assert.strictEqual(
findConfigurationPath(null, "./test/files/config-findup/contains-config"),
path.resolve("test/files/config-findup/contains-config/tslint.json"),
);
assert.strictEqual(
findConfigurationPath(null, "./test/files/config-findup/no-config"),
path.resolve("./test/files/config-findup/tslint.json"),
);
assert.strictEqual(
findConfigurationPath(null, "./test/files/config-findup"),
path.resolve("./test/files/config-findup/tslint.json"),
);
});
});

describe("loadConfigurationFromPath", () => {
it("extends with relative path", () => {
const config = loadConfigurationFromPath("./test/config/tslint-extends-relative.json");
Expand Down
1 change: 1 addition & 0 deletions test/files/config-findup/contains-config/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Empty file.
1 change: 1 addition & 0 deletions test/files/config-findup/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit c980298

Please sign in to comment.