mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 12:19:32 -05:00
Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options (#42544)
* Test when config file extends is incorrectly computed Test for #40720 * Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options Fixes #40720
This commit is contained in:
@@ -112,6 +112,7 @@
|
||||
"unittests/services/transpile.ts",
|
||||
"unittests/tsbuild/amdModulesWithOut.ts",
|
||||
"unittests/tsbuild/configFileErrors.ts",
|
||||
"unittests/tsbuild/configFileExtends.ts",
|
||||
"unittests/tsbuild/containerOnlyReferenced.ts",
|
||||
"unittests/tsbuild/declarationEmit.ts",
|
||||
"unittests/tsbuild/demo.ts",
|
||||
|
||||
52
src/testRunner/unittests/tsbuild/configFileExtends.ts
Normal file
52
src/testRunner/unittests/tsbuild/configFileExtends.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
namespace ts {
|
||||
describe("unittests:: tsbuild:: configFileExtends:: when tsconfig extends another config", () => {
|
||||
function getConfigExtendsWithIncludeFs() {
|
||||
return loadProjectFromFiles({
|
||||
"/src/tsconfig.json": JSON.stringify({
|
||||
references: [
|
||||
{ path: "./shared/tsconfig.json" },
|
||||
{ path: "./webpack/tsconfig.json" }
|
||||
],
|
||||
files: []
|
||||
}),
|
||||
"/src/shared/tsconfig-base.json": JSON.stringify({
|
||||
include: ["./typings-base/"]
|
||||
}),
|
||||
"/src/shared/typings-base/globals.d.ts": `type Unrestricted = any;`,
|
||||
"/src/shared/tsconfig.json": JSON.stringify({
|
||||
extends: "./tsconfig-base.json",
|
||||
compilerOptions: {
|
||||
composite: true,
|
||||
outDir: "../target-tsc-build/",
|
||||
rootDir: ".."
|
||||
},
|
||||
files: ["./index.ts"]
|
||||
}),
|
||||
"/src/shared/index.ts": `export const a: Unrestricted = 1;`,
|
||||
"/src/webpack/tsconfig.json": JSON.stringify({
|
||||
extends: "../shared/tsconfig-base.json",
|
||||
compilerOptions: {
|
||||
composite: true,
|
||||
outDir: "../target-tsc-build/",
|
||||
rootDir: ".."
|
||||
},
|
||||
files: ["./index.ts"],
|
||||
references: [{ path: "../shared/tsconfig.json" }]
|
||||
}),
|
||||
"/src/webpack/index.ts": `export const b: Unrestricted = 1;`,
|
||||
});
|
||||
}
|
||||
verifyTsc({
|
||||
scenario: "configFileExtends",
|
||||
subScenario: "when building solution with projects extends config with include",
|
||||
fs: getConfigExtendsWithIncludeFs,
|
||||
commandLineArgs: ["--b", "/src/tsconfig.json", "--v", "--listFiles"],
|
||||
});
|
||||
verifyTsc({
|
||||
scenario: "configFileExtends",
|
||||
subScenario: "when building project uses reference and both extend config with include",
|
||||
fs: getConfigExtendsWithIncludeFs,
|
||||
commandLineArgs: ["--b", "/src/webpack/tsconfig.json", "--v", "--listFiles"],
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user