Skip to content

Commit 2171303

Browse files
committed
run webpack 4 only on Node < 18
1 parent 10a3c53 commit 2171303

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

packages/integration-tests/fixtures/errorhandling/error-no-handler.test.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* eslint-disable jest/expect-expect */
33
import path from "path";
44
import { spawn } from "child_process";
5+
import { testIfNodeMajorVersionIsLessThan18 } from "../../utils/testIf";
56

67
jest.setTimeout(10_000);
78

@@ -26,7 +27,7 @@ describe("Error throwing by default (no errorHandler)", () => {
2627
sentryServer.kill();
2728
});
2829

29-
test.each(["vite", "rollup", "webpack5", "webpack4", "esbuild"])(
30+
test.each(["vite", "rollup", "webpack5", "esbuild"])(
3031
"doesn't throw when Sentry server responds with error code for %s",
3132
async (bundler) => {
3233
const buildProcess = spawn("yarn", ["ts-node", path.join(__dirname, `build-${bundler}.ts`)], {
@@ -49,4 +50,28 @@ describe("Error throwing by default (no errorHandler)", () => {
4950
buildProcess.kill();
5051
}
5152
);
53+
54+
testIfNodeMajorVersionIsLessThan18(
55+
"doesn't throw when Sentry server responds with error code for webpack 4",
56+
async () => {
57+
const buildProcess = spawn("yarn", ["ts-node", path.join(__dirname, `build-webpack4.ts`)], {
58+
env: { ...process.env, FAKE_SENTRY_PORT },
59+
stdio: "ignore", // <-- set to "inherit" to get build output. Deactivated to avoid spamming test logs.
60+
});
61+
62+
const exitCode = await new Promise<number>((resolve, reject) => {
63+
buildProcess.on("exit", (code) => {
64+
resolve(code ?? 99);
65+
});
66+
67+
buildProcess.on("error", (err) => {
68+
reject(err);
69+
});
70+
});
71+
72+
expect(exitCode).toBe(0);
73+
74+
buildProcess.kill();
75+
}
76+
);
5277
});

0 commit comments

Comments
 (0)