Set rootMode: "root" in loadPartialConfig (#13040)

This commit is contained in:
Nicolò Ribaudo 2021-03-23 20:11:10 +01:00 committed by GitHub
parent b784c81aeb
commit 564ca6638f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View File

@ -139,6 +139,7 @@ export default function* loadPrivatePartialConfig(
envName: context.envName,
cwd: context.cwd,
root: context.root,
rootMode: "root",
filename:
typeof context.filename === "string" ? context.filename : undefined,

View File

@ -982,6 +982,7 @@ describe("buildConfigChain", function () {
browserslistConfigFile: false,
cwd: process.cwd(),
root: process.cwd(),
rootMode: "root",
envName: "development",
passPerPreset: false,
plugins: [],

View File

@ -118,6 +118,25 @@ describe("@babel/core config loading", () => {
expect(item.value).toBe(preset);
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", () => {

View File

@ -0,0 +1 @@
{}