Skip to content

Commit ba684a1

Browse files
committed
loading prettier/standalone.js directly in tests when we can't know prettier's version
1 parent d9bafa3 commit ba684a1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/config/get-prettier.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import path from "node:path";
2+
import { createRequire } from "node:module";
3+
14
function getPrettierInternal() {
5+
const require = createRequire(import.meta.url);
6+
27
const entry = process.env.TEST_STANDALONE
3-
? "prettier/standalone"
8+
? path.join(path.dirname(require.resolve("prettier")), "standalone.js")
49
: "prettier";
510

611
return import(entry).then((module) => module.default);

0 commit comments

Comments
 (0)