Skip to content

Commit 62c1b80

Browse files
committed
Add test for array extends without .json extension.
1 parent 540a1c1 commit 62c1b80

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/__tests__/tsconfig-loader.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,4 +394,35 @@ describe("loadConfig", () => {
394394
},
395395
});
396396
});
397+
398+
it("should load a config with array extends without .json extension", () => {
399+
const baseConfig = {
400+
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
401+
};
402+
const baseConfigPath = join("/root", "base-config-1.json");
403+
const actualConfig = { extends: ["./base-config-1"] };
404+
const actualConfigPath = join("/root", "tsconfig.json");
405+
406+
const res = loadTsconfig(
407+
join("/root", "tsconfig.json"),
408+
(path) => [baseConfigPath, actualConfigPath].indexOf(path) >= 0,
409+
(path) => {
410+
if (path === baseConfigPath) {
411+
return JSON.stringify(baseConfig);
412+
}
413+
if (path === actualConfigPath) {
414+
return JSON.stringify(actualConfig);
415+
}
416+
return "";
417+
}
418+
);
419+
420+
expect(res).toEqual({
421+
extends: ["./base-config-1"],
422+
compilerOptions: {
423+
baseUrl: ".",
424+
paths: { foo: ["bar"] },
425+
},
426+
});
427+
});
397428
});

0 commit comments

Comments
 (0)