Skip to content

Commit

Permalink
Add test for array extends without .json extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSidhion committed Mar 29, 2023
1 parent 540a1c1 commit 62c1b80
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/__tests__/tsconfig-loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,35 @@ describe("loadConfig", () => {
},
});
});

it("should load a config with array extends without .json extension", () => {
const baseConfig = {
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
};
const baseConfigPath = join("/root", "base-config-1.json");
const actualConfig = { extends: ["./base-config-1"] };
const actualConfigPath = join("/root", "tsconfig.json");

const res = loadTsconfig(
join("/root", "tsconfig.json"),
(path) => [baseConfigPath, actualConfigPath].indexOf(path) >= 0,
(path) => {
if (path === baseConfigPath) {
return JSON.stringify(baseConfig);
}
if (path === actualConfigPath) {
return JSON.stringify(actualConfig);
}
return "";
}
);

expect(res).toEqual({
extends: ["./base-config-1"],
compilerOptions: {
baseUrl: ".",
paths: { foo: ["bar"] },
},
});
});
});

0 comments on commit 62c1b80

Please sign in to comment.