Skip to content

Commit 320d08a

Browse files
author
Paul Sachs
committed
Unwrapped promise
1 parent 1351fb9 commit 320d08a

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

test/playwright/extension.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -489,25 +489,25 @@ extensionTest.describe("lsp", async () => {
489489
await expect(
490490
page.getByRole("button", { name: "check Buf" })
491491
).toBeVisible();
492+
493+
const { promise, resolve, reject } = Promise.withResolvers<string>();
492494
const watcher = fs.watch(path.join(projectPath, "example.proto"));
493-
const formattedFileContent = new Promise((resolve, reject) => {
494-
watcher.on("change", () => {
495-
watcher.close();
496-
fs.readFile(
497-
path.join(projectPath, "example.proto"),
498-
{ encoding: "utf8" },
499-
(err, data) => {
500-
if (err) {
501-
reject(err);
502-
}
503-
resolve(data.toString());
495+
watcher.on("change", () => {
496+
watcher.close();
497+
fs.readFile(
498+
path.join(projectPath, "example.proto"),
499+
{ encoding: "utf8" },
500+
(err, data) => {
501+
if (err) {
502+
reject(err);
504503
}
505-
);
506-
});
504+
resolve(data.toString());
505+
}
506+
);
507507
});
508508

509509
await page.keyboard.press("ControlOrMeta+KeyS");
510-
const currentContent = await formattedFileContent;
510+
const currentContent = await promise;
511511
expect(currentContent).toBe(exampleUserProto);
512512
});
513513
});

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"module": "Node16",
44
"target": "ES2022",
55
"outDir": "out",
6-
"lib": ["ES2022"],
6+
"lib": ["ES2024"],
77
"skipLibCheck": true,
88
"sourceMap": true,
99
"strict": true /* enable all strict type-checking options */,

0 commit comments

Comments
 (0)