Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 3601719

Browse files
Fix wait.executeOnce() crashing on a null value
Unit/integration tests for this module will be added later
1 parent 82b7711 commit 3601719

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

runner-modules/wait/lib/content/trackRunResultEvents.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,22 @@ const trackRunResultEvents = (runResult, bluefox) => {
2222
};
2323
bluefox.onExecuteEnd = ({executionId}) => {
2424
const data = executions.get(executionId);
25-
data.end = new TimePoint();
25+
if (data) {
26+
data.end = new TimePoint();
27+
}
2628
};
2729
bluefox.onCheckBegin = ({executionId}) => {
2830
const data = executions.get(executionId);
29-
data.lastCheckBegin = performance.now();
31+
if (data) { // onExecuteBegin may not have been called if executeOnce() is used
32+
data.lastCheckBegin = performance.now();
33+
}
3034
};
3135
bluefox.onCheckEnd = ({executionId}) => {
3236
const data = executions.get(executionId);
33-
++data.checks;
34-
data.checksOverhead += performance.now() - data.lastCheckBegin;
37+
if (data) {
38+
++data.checks;
39+
data.checksOverhead += performance.now() - data.lastCheckBegin;
40+
}
3541
};
3642

3743
const drain = () => {

0 commit comments

Comments
 (0)