Repository navigation
fix: stop blaming failing tests for a test step that reported none - #146
Closed
EliSchleifer wants to merge 1 commit into
Closed
EliSchleifer wants to merge 1 commit into
EliSchleifer wants to merge 1 commit into
Conversation
`getFailureReason` chose its annotation purely from `previous-step-outcome`, so
any non-zero exit from the test step was reported as "The test results you are
uploading contain non quarantined test failures". That is wrong whenever the
command fails *without producing* failures — no test files matched its filter, a
build or setup error, a crash before results were written.
It matters because the annotation is the only part GitHub surfaces without
opening the log, and in exactly those runs the CLI has already printed the
correct diagnosis two lines above it:
⚠️ No test failures found, but non zero exit code provided: 1
This may indicate that some tests were not run or that there were other
issues during the test run.
##[error]The test results you are uploading contain non quarantined test failures
A reader trusting the annotation goes looking for a failing test that does not
exist. (Found chasing a trunk2 merge-queue failure that turned out to be a
package whose vitest run matched no test files.)
The action knows the step's outcome and never why, so the message now states
only that, points at the log, and names the alternative. A cancelled step gets
its own wording rather than being called a failure.
Tested on the message builder rather than through `core.setFailed`: `jest.mock`
does not intercept the ESM import in this suite, so the real `@actions/core`
runs and records nothing — which is why the existing tests only assert return
values.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dfrankland
added a commit
that referenced
this pull request
Oct 21, 2026
From #146. When the step that ran the tests failed, the annotation said "The test results you are uploading contain non quarantined test failures", which is wrong whenever the step failed without producing any: no test files matched, a build or setup error, a crash before results were written. The action knows the step's outcome and never why, so the message now says only that, points at the log, and names the alternative. A cancelled step gets its own wording rather than being called a failure. Exit code 70 keeps the generic message: that is the cli failing on its own, not the test step. Co-Authored-By: Eli Schleifer <eli@trunk.io> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
|
Thanks Eli. I've folded this into #152, with you as co-author on the commit, so I'm closing this one. The wording and the cancelled case are unchanged. Two changes around it:
Once the CLI's summary output (TRUNK-18881) lands, the hedge can become a certain "failed without running tests" message whenever zero tests were seen. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
getFailureReasonpicks its annotation fromprevious-step-outcomealone, soany non-zero exit from the step that ran the tests is reported as:
That is wrong whenever the test command fails without producing failures: no
test files matched its filter, a build or setup error, a crash before results
were written.
It matters more than the wording suggests, because the annotation is the only
part of a failure GitHub surfaces without opening the log — and in exactly those
runs the CLI has already printed the correct diagnosis two lines above it:
So the CLI says "no failures, something else went wrong" and the annotation
immediately contradicts it. A reader who trusts the annotation goes hunting for
a failing test that does not exist.
Found while chasing a trunk2 merge-queue failure. The actual cause was a package
whose
vitest runmatched no test files — vitest exits 1 on "No test filesfound" — so
pnpm -r testfailed a leg in whichFail: 0. The annotation sentme looking for a broken test for a while before I read the raw log.
What this changes
The action knows the step's outcome and never why, so the message now states
only that, points at the log, and names the alternative rather than asserting
one cause:
A cancelled step gets its own wording instead of being called a failure —
previousStepFailedalready treatscancelledas failed, so that case wasalso being reported as failing tests:
Rejected alternative
Having the CLI tell the action which case it is (an extra exit code or an
output) would let the annotation state the cause with certainty rather than
offering the reader two possibilities. That is the better end state, but it is a
two-repo change with a version-skew window, and it is not needed for the
annotation to stop being wrong. This PR is the half that can ship alone.
Testing
The three new assertions are on the exported message builder, not through
core.setFailed.jest.mock("@actions/core", …)does not intercept the ESMimport in this suite — the real
@actions/coreruns and the fixture recordsnothing, which I confirmed by watching real
::error::output during a runwhose
mock.callswas empty. That is also why the existing tests in this fileonly assert return values. Restructuring the suite onto
jest.unstable_mockModulewould be the way to assert through the mock; itseemed out of scope here, but happy to do it if you would rather.
pnpm testgreen (53 tests), anddist/rebuilt withpnpm buildsince theaction runs the committed bundle.