-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Labels
Description
Describe the bug
I'm developing a custom reporter by implementing the onTestRunEnd method of the Reporter interface. After the first test run failure, TestRunEnd Reason is reported as "failed" as expected. But any subsequent successful test run still reports the same "failed" value for TestRunEndReason instead of the expected "passed". The individual TestModules report "passed" in state() as expected.
I'm running in watch mode and using tsx to transpile the tests.
Reproduction
Code for reproduction:
import {
Reporter,
TestModule,
TestRunEndReason,
SerializedError,
} from "vitest/node";
export default class MyReporter implements Reporter {
constructor() {
}
async onTestRunEnd(
testModules: ReadonlyArray<TestModule>,
unhandledErrors: ReadonlyArray<SerializedError>,
reason: TestRunEndReason
): Promise<void> {
return new Promise<void>((resolve) => {
console.log("TestRunEndReason: " + reason);
testModules.forEach((tm, idx) => {
console.log(`Test Module state ${idx}: ` + tm.state());
});
resolve();
});
}
}
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Max
Memory: 1.79 GB / 32.00 GB
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 22.16.0 - ~/.nvm/versions/node/v22.16.0/bin/node
npm: 10.9.2 - ~/.nvm/versions/node/v22.16.0/bin/npm
bun: 1.2.6 - ~/.bun/bin/bun
Browsers:
Chrome: 137.0.7151.41
Safari: 18.5
npmPackages:
@vitest/coverage-v8: 3.1.4 => 3.1.4
vitest: 3.1.4 => 3.1.4
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.