Skip to content

Commit be41260

Browse files
committed
update bench
1 parent 79eb83c commit be41260

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

test/bundle.test.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,15 @@ import { fileURLToPath } from "node:url";
44
import zlib from "node:zlib";
55

66
describe("benchmark", () => {
7-
it("no side effects", async () => {
8-
const code = /* js */ `
9-
import { createHooks } from "../src/index.ts";
10-
`;
11-
const { bytes, output } = await getBundleSize(code);
12-
expect(output).toEqual("");
13-
expect(bytes).toBe(0);
14-
});
15-
167
it("new Hookable()", async () => {
178
const code = /* js */ `
189
import { Hookable } from "../src/index.ts";
1910
export default new Hookable()
2011
`;
2112
const { bytes, gzipSize } = await getBundleSize(code);
22-
// console.log("new Hookable():", { bytes, gzipSize });
13+
if (process.env.DEBUG) {
14+
console.log("new Hookable():", { bytes, gzipSize });
15+
}
2316
expect(bytes).toBeLessThan(3000);
2417
expect(gzipSize).toBeLessThan(1200);
2518
});
@@ -30,8 +23,9 @@ describe("benchmark", () => {
3023
export default new HookableCore()
3124
`;
3225
const { bytes, gzipSize } = await getBundleSize(code);
33-
// console.log("output:", output);
34-
console.log("new HookableCore():", { bytes, gzipSize });
26+
if (process.env.DEBUG) {
27+
console.log("new HookableCore():", { bytes, gzipSize });
28+
}
3529
expect(bytes).toBeLessThan(640);
3630
expect(gzipSize).toBeLessThan(380);
3731
});
@@ -59,6 +53,6 @@ async function getBundleSize(code: string) {
5953
return {
6054
bytes,
6155
gzipSize,
62-
output: new TextDecoder().decode(res.outputFiles[0].contents),
56+
// output: new TextDecoder().decode(res.outputFiles[0].contents),
6357
};
6458
}

0 commit comments

Comments
 (0)