Skip to content

Commit

Permalink
Show jest tests which ran in the recording as console messages (#5496)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhackett1024 authored Feb 28, 2022
1 parent 18e5f46 commit 2f9016e
Show file tree
Hide file tree
Showing 6 changed files with 465 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/devtools/client/webconsole/actions/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {
const { IdGenerator } = require("devtools/client/webconsole/utils/id-generator");
const { ThreadFront } = require("protocol/thread");
const { LogpointHandlers } = require("protocol/logpoint");
const { TestMessageHandlers } = require("protocol/find-tests");

const {
MESSAGES_ADD,
Expand All @@ -36,6 +37,7 @@ export function setupMessages(store) {
LogpointHandlers.onResult = (logGroupId, point, time, location, pause, values) =>
store.dispatch(onLogpointResult(logGroupId, point, time, location, pause, values));
LogpointHandlers.clearLogpoint = logGroupId => store.dispatch(messagesClearLogpoint(logGroupId));
TestMessageHandlers.onTestMessage = msg => store.dispatch(onConsoleMessage(msg));

ThreadFront.findConsoleMessages(
(_, msg) => store.dispatch(onConsoleMessage(msg)),
Expand Down
10 changes: 10 additions & 0 deletions src/protocol/analysisManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AnalysisId,
analysisPoints,
analysisResult,
ExecutionPoint,
PointDescription,
SessionId,
} from "@recordreplay/protocol";
Expand All @@ -22,6 +23,7 @@ export interface AnalysisParams {
eventHandlerEntryPoints?: EventHandlerEntryPoint[];
exceptionPoints?: boolean;
randomPoints?: number;
points?: ExecutionPoint[];
sessionId: SessionId;
}

Expand Down Expand Up @@ -98,6 +100,14 @@ class AnalysisManager {
);
}

if (params.points) {
await sendMessage(
"Analysis.addPoints",
{ analysisId, points: params.points },
params.sessionId
);
}

this.handlers.set(analysisId, handler);
await Promise.all([
!handler.onAnalysisResult ||
Expand Down
4 changes: 4 additions & 0 deletions src/protocol/execution-point-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ export function pointEquals(p1: ExecutionPoint, p2: ExecutionPoint) {
export function pointPrecedes(p1: ExecutionPoint, p2: ExecutionPoint) {
return compareNumericStrings(p1, p2) < 0;
}

export function comparePoints(p1: ExecutionPoint, p2: ExecutionPoint) {
return compareNumericStrings(p1, p2);
}
Loading

1 comment on commit 2f9016e

@vercel
Copy link

@vercel vercel bot commented on 2f9016e Feb 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.