Skip to content

Commit 8c11608

Browse files
test: fix
1 parent d54d91c commit 8c11608

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

test/logging.test.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from "node:fs";
2+
import os from "node:os";
23
import path from "node:path";
34
import { stripVTControlCharacters } from "node:util";
45

@@ -864,48 +865,49 @@ describe.each(scenarios)("logging $name", ({ args }) => {
864865
});
865866
});
866867

867-
it('should logging an error from the fs error when the "writeToDisk" option is "true"', (done) => {
868-
const outputDir = path.resolve(
869-
__dirname,
870-
"./outputs/write-to-disk-mkdir-error",
871-
);
872-
873-
fs.mkdirSync(outputDir, { recursive: true });
874-
fs.chmodSync(outputDir, 0o400);
875-
876-
const proc = execa(runner, args, {
877-
reject: false,
878-
stdio: "pipe",
879-
env: {
880-
WEBPACK_CONFIG: "webpack.simple.config",
881-
WCF_output_filename: "bundle.js",
882-
WCF_output_path: outputDir,
883-
WCF_infrastructureLogging_level: "log",
884-
WMC_writeToDisk: true,
885-
},
886-
});
887-
888-
let stderr = "";
889-
890-
proc.stderr.on("data", (chunk) => {
891-
stderr += chunk.toString();
892-
proc.stdin.write("|exit|");
893-
});
868+
if (os.platform() !== "win32") {
869+
it('should logging an error from the fs error when the "writeToDisk" option is "true"', (done) => {
870+
const outputDir = path.resolve(
871+
__dirname,
872+
"./outputs/write-to-disk-mkdir-error",
873+
);
874+
875+
fs.mkdirSync(outputDir, { recursive: true });
876+
fs.chmodSync(outputDir, 0o400);
877+
878+
const proc = execa(runner, args, {
879+
reject: false,
880+
stdio: "pipe",
881+
env: {
882+
WEBPACK_CONFIG: "webpack.simple.config",
883+
WCF_output_filename: "bundle.js",
884+
WCF_output_path: outputDir,
885+
WCF_infrastructureLogging_level: "log",
886+
WMC_writeToDisk: true,
887+
},
888+
});
889+
890+
let stderr = "";
891+
892+
proc.stderr.on("data", (chunk) => {
893+
stderr += chunk.toString();
894+
proc.stdin.write("|exit|");
895+
});
894896

895-
proc.on("error", (error) => {
896-
done(error);
897-
});
897+
proc.on("error", (error) => {
898+
done(error);
899+
});
898900

899-
proc.on("exit", () => {
900-
console.warn(stderr);
901-
expect(extractErrorEntry(stderr)).toMatch("Error: EACCES");
901+
proc.on("exit", () => {
902+
expect(extractErrorEntry(stderr)).toMatch("Error: EACCES");
902903

903-
fs.chmodSync(outputDir, 0o700);
904-
fs.rmSync(outputDir, { recursive: true, force: true });
904+
fs.chmodSync(outputDir, 0o700);
905+
fs.rmSync(outputDir, { recursive: true, force: true });
905906

906-
done();
907+
done();
908+
});
907909
});
908-
});
910+
}
909911

910912
it('should logging on successfully build using the "stats" option for middleware with the "true" value', (done) => {
911913
const proc = execa(runner, args, {

0 commit comments

Comments
 (0)