Skip to content

Commit 5908de2

Browse files
authored
Patch jest-runner-prettier to work with Prettier 3 (#2363)
# Summary I completely forgot about keplersj/jest-runner-prettier#586 and this has been broken for a while. # Test Plan This is why I love `pnpm` ```shell pnpm patch jest-runner-prettier # add the awaits everywhere pnpm patch-commit '/tmp/67d6a1a8e116289cd91a5e6eeb4f413d' ``` Break formatting in a file. `pnpm test:prettier`. Finally it registers.
1 parent 0a19b75 commit 5908de2

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
"jsdom": "^22",
5656
"mock-socket": "^9.3.1",
5757
"shelljs": ">=0.8.5"
58+
},
59+
"patchedDependencies": {
60+
5861
}
5962
},
6063
"prettier": "@solana/prettier-config-solana"

patches/[email protected]

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
diff --git a/dist/run.js b/dist/run.js
2+
index fdee17d2377dd013d55de1d54bee9d241894e800..7139e496da63da74b3e7966f4a3f5a613a7f3b3b 100644
3+
--- a/dist/run.js
4+
+++ b/dist/run.js
5+
@@ -11,7 +11,7 @@ export default async ({ testPath }) => {
6+
...config,
7+
filepath: testPath,
8+
};
9+
- const isPretty = prettier.check(contents, prettierConfig);
10+
+ const isPretty = await prettier.check(contents, prettierConfig);
11+
if (isPretty) {
12+
return pass({
13+
start,
14+
@@ -19,7 +19,7 @@ export default async ({ testPath }) => {
15+
test: { path: testPath },
16+
});
17+
}
18+
- const formatted = prettier.format(contents, prettierConfig);
19+
+ const formatted = await prettier.format(contents, prettierConfig);
20+
return fail({
21+
start,
22+
end: Date.now(),
23+
diff --git a/src/run.ts b/src/run.ts
24+
index 1775851defdca87b753f1f9bae1cb663332eb640..b6c72e13f82d9e9ed3aef5095f8b8d82e2b4391b 100644
25+
--- a/src/run.ts
26+
+++ b/src/run.ts
27+
@@ -19,7 +19,7 @@ export default async ({ testPath }: Parameters): Promise<TestResult> => {
28+
filepath: testPath,
29+
};
30+
31+
- const isPretty = prettier.check(contents, prettierConfig);
32+
+ const isPretty = await prettier.check(contents, prettierConfig);
33+
if (isPretty) {
34+
return pass({
35+
start,
36+
@@ -28,7 +28,7 @@ export default async ({ testPath }: Parameters): Promise<TestResult> => {
37+
});
38+
}
39+
40+
- const formatted = prettier.format(contents, prettierConfig);
41+
+ const formatted = await prettier.format(contents, prettierConfig);
42+
43+
return fail({
44+
start,

pnpm-lock.yaml

+8-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)