Skip to content

Commit

Permalink
chore: bench
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Mar 13, 2024
1 parent e78312a commit 9fd68e4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"workspaces": ["src", "example"],
"scripts": {
"bench": "vitest bench",
"build": "bun run clean && tsc --project ./tsconfig.build.json && bun .scripts/postbuild.ts",
"changeset": "changeset",
"changeset:release": "bun run build && changeset publish",
Expand Down
27 changes: 27 additions & 0 deletions src/response.bench.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { bench, expect } from "vitest";
import { ImageResponse } from "./response.js";

bench("png", async () => {
const response = new ImageResponse(
<div

Check failure on line 6 in src/response.bench.tsx

View workflow job for this annotation

GitHub Actions / Release canary

Cannot use JSX unless the '--jsx' flag is provided.
style={{ backgroundColor: "red", fontSize: 60, width: 500, height: 500 }}
>
hello
</div>,
);
expect(response).toBeDefined();
expect(new Uint8Array(await response.arrayBuffer())).toBeDefined();
});

bench("svg", async () => {
const response = new ImageResponse(
<div

Check failure on line 18 in src/response.bench.tsx

View workflow job for this annotation

GitHub Actions / Release canary

Cannot use JSX unless the '--jsx' flag is provided.
style={{ backgroundColor: "red", fontSize: 60, width: 500, height: 500 }}
>
hello
</div>,
{ format: "svg" },
);
expect(response).toBeDefined();
expect(new Uint8Array(await response.arrayBuffer())).toBeDefined();
});
2 changes: 1 addition & 1 deletion src/utils/svgToPng.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { elementToSvg } from "./elementToSvg.js";
import { initializeWasm } from "./initializeWasm.js";
import { svgToPng } from "./svgToPng.js";

test("default", async () => {
test.skip("default", async () => {
await initializeWasm();
const svg = await elementToSvg(
<div
Expand Down

0 comments on commit 9fd68e4

Please sign in to comment.