Skip to content

Commit

Permalink
test: Show more details when jest test have >1 process recording
Browse files Browse the repository at this point in the history
  • Loading branch information
dividedmind committed Apr 24, 2024
1 parent 4721ad9 commit 338ff88
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/jest.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { format } from "node:util";

import { integrationTest, readAppmaps, runAppmapNode, runAppmapNodeWithOptions } from "./helpers";

integrationTest("mapping Jest tests", () => {
Expand All @@ -20,7 +22,12 @@ integrationTest("mapping Jest tests with process recording active", () => {
).toBe(1);
const appmaps = readAppmaps();
const appmapsArray = Object.values(appmaps);
expect(appmapsArray.filter((a) => a.metadata?.recorder.type == "process").length).toEqual(1);

const processMaps = Object.entries(appmaps).filter(
([, a]) => a.metadata?.recorder.type == "process",
);
if (processMaps.length != 1)
throw new Error(format("expected one process appmap, got: ", Object.fromEntries(processMaps)));
expect(appmapsArray.filter((a) => a.metadata?.recorder.type == "tests").length).toEqual(5);
expect(appmaps).toMatchSnapshot();
});

0 comments on commit 338ff88

Please sign in to comment.