Skip to content

Commit 4322534

Browse files
authored
fix: fix compatibility with older testplane versions and stop writing invalid warnings (#656)
1 parent f7148b0 commit 4322534

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/adapters/event-handling/testplane/snapshots.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ export const finalizeSnapshotsForTest = async ({testResult, attempt, reportPath,
8383

8484
delete snapshotsInProgress[hash];
8585

86-
if (!snapshots || snapshots.length === 0) {
87-
console.warn(`No snapshots found for test hash: ${hash}`);
86+
// Here we only check LastFailedRun, because in case of Off, we wouldn't even be here. LastFailedRun is the only case when we may want to not save snapshots.
87+
const shouldSave = RecordMode && recordConfig && (recordConfig.mode !== RecordMode.LastFailedRun || (eventName === events.TEST_FAIL));
88+
if (!shouldSave) {
8889
return [];
8990
}
9091

91-
const shouldSave = RecordMode && (recordConfig.mode !== RecordMode.LastFailedRun || (eventName === events.TEST_FAIL));
92-
if (!shouldSave) {
92+
if (!snapshots || snapshots.length === 0) {
93+
console.warn(`No snapshots found for test hash: ${hash}`);
9394
return [];
9495
}
9596

lib/adapters/tool/testplane/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class TestplaneToolAdapter implements ToolAdapter {
110110
for (const browserConfig of this._browserConfigs) {
111111
const features: BrowserFeature[] = [];
112112

113-
if (browserConfig.record.mode === RecordMode.On) {
113+
if (RecordMode && browserConfig.record && browserConfig.record.mode === RecordMode.On) {
114114
features.push(BrowserFeature.LiveSnapshotsStreaming);
115115
}
116116

0 commit comments

Comments
 (0)