Skip to content

Commit 744c627

Browse files
test: fix
1 parent bff4e9a commit 744c627

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

test/logging.test.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ describe.each(scenarios)("logging $name", ({ args }) => {
866866
});
867867

868868
if (os.platform() !== "win32") {
869-
it('should logging an error from the fs error when the "writeToDisk" option is "true"', (done) => {
869+
it('should logging an error from the fs error when the "writeToDisk" option is "true"', async () => {
870870
const outputDir = path.resolve(
871871
__dirname,
872872
"./outputs/write-to-disk-mkdir-error",
@@ -876,6 +876,7 @@ describe.each(scenarios)("logging $name", ({ args }) => {
876876
fs.chmodSync(outputDir, 0o400);
877877

878878
const proc = execa(runner, args, {
879+
all: true,
879880
reject: false,
880881
stdio: "pipe",
881882
env: {
@@ -887,25 +888,16 @@ describe.each(scenarios)("logging $name", ({ args }) => {
887888
},
888889
});
889890

890-
let stderr = "";
891-
892-
proc.stderr.on("data", (chunk) => {
893-
stderr += chunk.toString();
891+
proc.stderr.on("data", () => {
894892
proc.stdin.write("|exit|");
895893
});
896894

897-
proc.on("error", (error) => {
898-
done(error);
899-
});
900-
901-
proc.on("close", () => {
902-
expect(extractErrorEntry(stderr)).toMatch("Error: EACCES");
895+
const { all } = await proc;
903896

904-
fs.chmodSync(outputDir, 0o700);
905-
fs.rmSync(outputDir, { recursive: true, force: true });
897+
expect(extractErrorEntry(all)).toMatch("Error: EACCES");
906898

907-
done();
908-
});
899+
fs.chmodSync(outputDir, 0o700);
900+
fs.rmSync(outputDir, { recursive: true, force: true });
909901
});
910902
}
911903

0 commit comments

Comments
 (0)