Describe the bug
Related
Not only --merge-reports, but normal test run also silences reporter errors that are thrown during test runtime event such as onUserConsoleLog.
import { test } from 'vitest';
test('foo', () => {
console.log('test-crash');
});
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
reporters: [
'default',
{
onUserConsoleLog(log) {
if (log.content.includes('test-crash')) {
console.log('throwing an error from Reporter.onUserConsoleLog!');
throw new Error('reporter error during onUserConsoleLog');
}
},
},
],
},
});
Test finishes with no errors:
❯ vitest --run
RUN v4.1.0-beta.4 /home/projects/vitest-dev-vitest-9qgrszam
stdout | test/repro.test.ts > foo
test-crash
throwing an error from Reporter.onUserConsoleLog!
✓ test/repro.test.ts (1 test) 3ms
✓ foo 2ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 11:59:16
Duration 621ms (transform 37ms, setup 0ms, import 52ms, tests 3ms, environment 0ms)
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-9qgrszam?file=vitest.config.ts
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
vitest: beta => 4.1.0-beta.4
Used Package Manager
npm
Validations
Describe the bug
Related
--merge-reports#9642Not only
--merge-reports, but normal test run also silences reporter errors that are thrown during test runtime event such asonUserConsoleLog.Test finishes with no errors:
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-9qgrszam?file=vitest.config.ts
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 20.19.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.8.2 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vitest: beta => 4.1.0-beta.4Used Package Manager
npm
Validations