Skip to content

Commit 600f2ab

Browse files
committed
run webpack 4 test
1 parent 5d8d658 commit 600f2ab

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

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

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

76
jest.setTimeout(10_000);
87

@@ -28,7 +27,13 @@ describe("Error throwing by default (no errorHandler)", () => {
2827
sentryServer.kill();
2928
});
3029

31-
test.each(["vite", "rollup", "webpack5", "esbuild"])(
30+
const bundlersToTest = ["vite", "rollup", "webpack5", "esbuild"];
31+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32+
if (parseInt(process.version.split(".")[0]!.slice(1)) < 18) {
33+
bundlersToTest.push("webpack4");
34+
}
35+
36+
test.each(bundlersToTest)(
3237
"doesn't throw when Sentry server responds with error code for %s",
3338
async (bundler) => {
3439
const buildProcess = spawn("yarn", ["ts-node", path.join(__dirname, `build-${bundler}.ts`)], {
@@ -52,29 +57,4 @@ describe("Error throwing by default (no errorHandler)", () => {
5257
buildProcess.kill();
5358
}
5459
);
55-
56-
testIfNodeMajorVersionIsLessThan18(
57-
"doesn't throw when Sentry server responds with error code for webpack 4",
58-
async () => {
59-
const buildProcess = spawn("yarn", ["ts-node", path.join(__dirname, `build-webpack4.ts`)], {
60-
env: { ...process.env, FAKE_SENTRY_PORT },
61-
stdio: "ignore", // <-- set to "inherit" to get build output. Deactivated to avoid spamming test logs.
62-
shell: true,
63-
});
64-
65-
const exitCode = await new Promise<number>((resolve, reject) => {
66-
buildProcess.on("exit", (code) => {
67-
resolve(code ?? 99);
68-
});
69-
70-
buildProcess.on("error", (err) => {
71-
reject(err);
72-
});
73-
});
74-
75-
expect(exitCode).toBe(0);
76-
77-
buildProcess.kill();
78-
}
79-
);
8060
});

0 commit comments

Comments
 (0)