Skip to content

Commit

Permalink
Fix parsing for snapshot generation (#612)
Browse files Browse the repository at this point in the history
There was a bug where if all tests passed it would obscure the detection
of a mismatch. Mismatched version should never trigger snapshot
auto-generation. This caused this
[PR](#611) to be erroneously
generated.
  • Loading branch information
TylerJang27 authored Jan 5, 2024
1 parent 45ec7e2 commit 29549d0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/parse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ const mergeTestFailureMetadata = (original: TestResult, incoming: TestResult) =>
([testFullName, incomingSuspectedFailureMode]) => {
const originalSuspectedFailureMode = original.testFailureMetadata.get(testFullName);
if (originalSuspectedFailureMode) {
// If the incoming test result is a pass, invalidate the failure mode
if (incoming.testResultStatus === "passed") {
original.testFailureMetadata.set(testFullName, "passed");
return;
}

// If the incoming test result is a version mismatch, invalidate the failure mode
if (incoming.version && original.version && incoming.version !== original.version) {
original.testFailureMetadata.set(testFullName, "unknown");
return;
}

// If the incoming test result is a pass, invalidate the failure mode
if (incoming.testResultStatus === "passed") {
original.testFailureMetadata.set(testFullName, "passed");
return;
}

// If the incoming test result is a failure and not assertion_failure, **invalidate the failure mode
if (incomingSuspectedFailureMode !== "assertion_failure") {
original.testFailureMetadata.set(testFullName, incomingSuspectedFailureMode);
Expand Down

0 comments on commit 29549d0

Please sign in to comment.