Comments (3)
I think what appears duplicated is Error.message
since JUnit output it to two places:
<failure message="...(here)...">
...(and here)...
...
</failure>
jest-extended
's assertion error puts everything to single Error.message
string, so probably that's what's happening. Vitest (originally chai?) assertion error has separate Error.message/actual/expected/diff
fields, so this doesn't happen. Here is a quick repro:
https://stackblitz.com/edit/vitest-dev-vitest-7hsjhp?file=test%2Frepro.test.ts
junit.xml
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites name="vitest tests" tests="3" failures="3" errors="0" time="3.535">
<testsuite name="test/repro.test.ts" timestamp="2024-05-04T03:52:15.731Z" hostname="vitestdevvitest7hsjhp-btis" tests="3" failures="3" errors="0" skipped="0" time="0.018">
<testcase classname="test/repro.test.ts" name="repro" time="0.009">
<failure message="[2mexpect([22m[31mreceived[39m[2m).toIncludeMultiple([22m[32mexpected[39m[2m)[22m
Expected string to contain all substrings:
[32mArray [
"yo",
][39m
Received:
[31m"hey"[39m" type="Error">
Error: expect(received).toIncludeMultiple(expected)
Expected string to contain all substrings:
Array [
"yo",
]
Received:
"hey"
❯ eval test/repro.test.ts:7:17
</failure>
</testcase>
<testcase classname="test/repro.test.ts" name="multiline message" time="0.002">
<failure message="hello
world
goodbye" type="Error">
Error: hello
world
goodbye
❯ eval test/repro.test.ts:11:9
</failure>
</testcase>
<testcase classname="test/repro.test.ts" name="native" time="0.005">
<failure message="expected +0 to be 1 // Object.is equality" type="AssertionError">
AssertionError: expected +0 to be 1 // Object.is equality
- Expected
+ Received
- 1
+ 0
❯ eval test/repro.test.ts:15:13
</failure>
</testcase>
</testsuite>
</testsuites>
Is there something inconvenient about this duplicate? I suppose it's all depend on how CI platform's UI renders it, so if you have any suggestions, please feel free to share.
Currently I see multiline string in <failure message="...">
attribute, so probably that one needs to be escaped.
(EDIT: ah maybe not, it looks like multiline attirbute is a legitimate thing)
from vitest.
Hi. I thought that was somehow connected to console.logs / silent mode.
Anyway, it doesn't bother me as much.
Thank you for investigating this!
from vitest.
Okay, this seems fine for now, so closing.
Please feel free to report again if this causes concrete issues downstream.
from vitest.
Related Issues (20)
- module mock failure on react-router-dom in browser mode HOT 2
- Snapshots modify input by unexpectedly trimming and adjusting indentation
- Unable to npm install @vitest/ui HOT 1
- stack trace incorrect for unhandled errors during test run in browser mode
- expect(...).toMatchSnapshot has typescript error since v2 of vitest HOT 2
- "TypeError: Cannot create proxy with a non-object as target or handler" when importing node module with a Proxy
- stack trace incorrect when react component throws with istanbul coverage HOT 1
- `@vitest/web-worker` didn't transform `.wasm?url` in worker import HOT 11
- Custom equality testers are not properly relayed to typed arrays HOT 2
- correct type for `import { defineConfig } from 'vitest/config';` with `"type": "commonjs"` HOT 1
- Pass down context to `onTestFinished` and `onTestFailed` instead of test result
- Some coverage.exclude glob patterns not matching for vitest 2 workspace HOT 4
- TypeError: Unknown file extension ".css"
- `tsc` with `"vitest"` version 2 requires `"@types/node"` to run without errors HOT 2
- Add 'coverageLinkUrl' option in Vitest UI for custom coverage report links
- Improve Vitest Public API
- Browser docs refer to defineCommand function which doesn't exist
- False negative with typecheck enabled
- `Error: Failed to load url` when dynamic importing js files generated during tests with relative path
- Istanbul: Coverage ignore doesn't work for default in switch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitest.