Giter VIP home page Giter VIP logo

Comments (3)

hi-ogawa avatar hi-ogawa commented on July 17, 2024

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 [
  &quot;yo&quot;,
][39m
Received:
  [31m&quot;hey&quot;[39m" type="Error">
Error: expect(received).toIncludeMultiple(expected)

Expected string to contain all substrings: 
  Array [
  &quot;yo&quot;,
]
Received:
  &quot;hey&quot;
 ❯ 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.

andrii-nastenko avatar andrii-nastenko commented on July 17, 2024

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.

hi-ogawa avatar hi-ogawa commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.