Accept URL as custom config file in resolveConfig (#17167)
This commit is contained in:
1 parent
e830ad36a7
commit
5dc7e8e54a
5 files changed
+38
-1
No files matched your search
@@ -459,3 +459,21 @@ test("package.json/package.yaml", async () => {
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
test("'config' option should accept `URL` and `string`", async () => {
|
||||
const configFileUrl = new URL(
|
||||
"../cli/config/custom-config-file-location/my-prettier-config.mjs",
|
||||
import.meta.url,
|
||||
);
|
||||
const file = new URL("./file.js", configFileUrl);
|
||||
|
||||
for (const configFile of [
|
||||
configFileUrl,
|
||||
configFileUrl.href,
|
||||
url.fileURLToPath(configFileUrl),
|
||||
]) {
|
||||
await expect(
|
||||
prettier.resolveConfig(file, { config: configFile }),
|
||||
).resolves.toEqual({ tabWidth: 7 });
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
tabWidth: 7
|
||||
}
|
||||
Reference in new issue
Block a user