|
1 | 1 | import fs from "node:fs"; |
| 2 | +import os from "node:os"; |
2 | 3 | import path from "node:path"; |
3 | 4 | import { stripVTControlCharacters } from "node:util"; |
4 | 5 |
|
@@ -864,48 +865,49 @@ describe.each(scenarios)("logging $name", ({ args }) => { |
864 | 865 | }); |
865 | 866 | }); |
866 | 867 |
|
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 | + }); |
894 | 896 |
|
895 | | - proc.on("error", (error) => { |
896 | | - done(error); |
897 | | - }); |
| 897 | + proc.on("error", (error) => { |
| 898 | + done(error); |
| 899 | + }); |
898 | 900 |
|
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"); |
902 | 903 |
|
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 }); |
905 | 906 |
|
906 | | - done(); |
| 907 | + done(); |
| 908 | + }); |
907 | 909 | }); |
908 | | - }); |
| 910 | + } |
909 | 911 |
|
910 | 912 | it('should logging on successfully build using the "stats" option for middleware with the "true" value', (done) => { |
911 | 913 | const proc = execa(runner, args, { |
|
0 commit comments