Resolve .browserslistrc as a project-wide file (#13028)
This commit is contained in:
3
packages/babel-core/test/fixtures/targets/node_modules/dep/.babelrc.json
generated
vendored
Normal file
3
packages/babel-core/test/fixtures/targets/node_modules/dep/.babelrc.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"browserslistConfigFile": "./.browserslistrc"
|
||||
}
|
||||
@@ -91,11 +91,24 @@ describe("browserslist", () => {
|
||||
).toEqual({ chrome: "80.0.0" });
|
||||
});
|
||||
|
||||
it("loads .browserslistrc relative to the input file", () => {
|
||||
it("loads .browserslistrc relative to the root", () => {
|
||||
expect(
|
||||
loadOptions({
|
||||
cwd: join(cwd, "fixtures", "targets"),
|
||||
filename: "./nested/test.js",
|
||||
filename: "./node_modules/dep/test.js",
|
||||
}).targets,
|
||||
).toEqual({ chrome: "80.0.0" });
|
||||
});
|
||||
|
||||
// TODO: browserslistConfig is currently resolved starting from the root
|
||||
// rather than from the config file.
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
it.skip("loads nested .browserslistrc files if explicitly specified", () => {
|
||||
expect(
|
||||
loadOptions({
|
||||
cwd: join(cwd, "fixtures", "targets"),
|
||||
filename: "./node_modules/dep/test.js",
|
||||
babelrcRoots: ["./node_modules/dep/"],
|
||||
}).targets,
|
||||
).toEqual({ edge: "14.0.0" });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user