Set rootMode: "root" in loadPartialConfig (#13040)
This commit is contained in:
parent
b784c81aeb
commit
564ca6638f
@ -139,6 +139,7 @@ export default function* loadPrivatePartialConfig(
|
|||||||
envName: context.envName,
|
envName: context.envName,
|
||||||
cwd: context.cwd,
|
cwd: context.cwd,
|
||||||
root: context.root,
|
root: context.root,
|
||||||
|
rootMode: "root",
|
||||||
filename:
|
filename:
|
||||||
typeof context.filename === "string" ? context.filename : undefined,
|
typeof context.filename === "string" ? context.filename : undefined,
|
||||||
|
|
||||||
|
|||||||
@ -982,6 +982,7 @@ describe("buildConfigChain", function () {
|
|||||||
browserslistConfigFile: false,
|
browserslistConfigFile: false,
|
||||||
cwd: process.cwd(),
|
cwd: process.cwd(),
|
||||||
root: process.cwd(),
|
root: process.cwd(),
|
||||||
|
rootMode: "root",
|
||||||
envName: "development",
|
envName: "development",
|
||||||
passPerPreset: false,
|
passPerPreset: false,
|
||||||
plugins: [],
|
plugins: [],
|
||||||
|
|||||||
@ -118,6 +118,25 @@ describe("@babel/core config loading", () => {
|
|||||||
expect(item.value).toBe(preset);
|
expect(item.value).toBe(preset);
|
||||||
expect(item.options).toBe(false);
|
expect(item.options).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should always set 'rootMode' to 'root'", async () => {
|
||||||
|
const cwd = path.join(
|
||||||
|
path.dirname(fileURLToPath(import.meta.url)),
|
||||||
|
"fixtures",
|
||||||
|
"config-loading",
|
||||||
|
"root",
|
||||||
|
"nested",
|
||||||
|
);
|
||||||
|
|
||||||
|
const { options } = await loadPartialConfig({
|
||||||
|
cwd,
|
||||||
|
filename: path.join(cwd, "file.js"),
|
||||||
|
rootMode: "upward",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(options.root).toBe(path.join(cwd, ".."));
|
||||||
|
expect(options.rootMode).toBe("root");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("config file", () => {
|
describe("config file", () => {
|
||||||
|
|||||||
1
packages/babel-core/test/fixtures/config-loading/root/babel.config.json
vendored
Normal file
1
packages/babel-core/test/fixtures/config-loading/root/babel.config.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
Loading…
x
Reference in New Issue
Block a user