-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathbasic-release-injection.test.ts
More file actions
39 lines (33 loc) · 1.08 KB
/
basic-release-injection.test.ts
File metadata and controls
39 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import childProcess from "child_process";
import path from "path";
import { testIfNodeMajorVersionIsLessThan18 } from "../../utils/testIf";
/**
* Runs a node file in a seprate process.
*
* @param bundlePath Path of node file to run
* @returns Stdout of the process
*/
function checkBundle(bundlePath: string): void {
const processOutput = childProcess.execSync(`node ${bundlePath}`, { encoding: "utf-8" });
expect(processOutput).toBe("I AM A RELEASE!");
}
test("esbuild bundle", () => {
expect.assertions(1);
checkBundle(path.join(__dirname, "./out/esbuild/index.js"));
});
test("rollup bundle", () => {
expect.assertions(1);
checkBundle(path.join(__dirname, "./out/rollup/index.js"));
});
test("vite bundle", () => {
expect.assertions(1);
checkBundle(path.join(__dirname, "./out/vite/index.js"));
});
testIfNodeMajorVersionIsLessThan18("webpack 4 bundle", () => {
expect.assertions(1);
checkBundle(path.join(__dirname, "./out/webpack4/index.js"));
});
test("webpack 5 bundle", () => {
expect.assertions(1);
checkBundle(path.join(__dirname, "./out/webpack5/index.js"));
});