• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1namespace ts {
2    describe("unittests:: tsbuild:: configFileExtends:: when tsconfig extends another config", () => {
3        function getConfigExtendsWithIncludeFs() {
4            return loadProjectFromFiles({
5                "/src/tsconfig.json": JSON.stringify({
6                    references: [
7                        { path: "./shared/tsconfig.json" },
8                        { path: "./webpack/tsconfig.json" }
9                    ],
10                    files: []
11                }),
12                "/src/shared/tsconfig-base.json": JSON.stringify({
13                    include: ["./typings-base/"]
14                }),
15                "/src/shared/typings-base/globals.d.ts": `type Unrestricted = any;`,
16                "/src/shared/tsconfig.json": JSON.stringify({
17                    extends: "./tsconfig-base.json",
18                    compilerOptions: {
19                        composite: true,
20                        outDir: "../target-tsc-build/",
21                        rootDir: ".."
22                    },
23                    files: ["./index.ts"]
24                }),
25                "/src/shared/index.ts": `export const a: Unrestricted = 1;`,
26                "/src/webpack/tsconfig.json": JSON.stringify({
27                    extends: "../shared/tsconfig-base.json",
28                    compilerOptions: {
29                        composite: true,
30                        outDir: "../target-tsc-build/",
31                        rootDir: ".."
32                    },
33                    files: ["./index.ts"],
34                    references: [{ path: "../shared/tsconfig.json" }]
35                }),
36                "/src/webpack/index.ts": `export const b: Unrestricted = 1;`,
37            });
38        }
39        verifyTsc({
40            scenario: "configFileExtends",
41            subScenario: "when building solution with projects extends config with include",
42            fs: getConfigExtendsWithIncludeFs,
43            commandLineArgs: ["--b", "/src/tsconfig.json", "--v", "--listFiles"],
44        });
45        verifyTsc({
46            scenario: "configFileExtends",
47            subScenario: "when building project uses reference and both extend config with include",
48            fs: getConfigExtendsWithIncludeFs,
49            commandLineArgs: ["--b", "/src/webpack/tsconfig.json", "--v", "--listFiles"],
50        });
51    });
52}