Closed bodograumann closed 8 months ago
Vitest supports toContain
with classList
since 1.0.
Hello @bodograumann. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction
will be closed if they have no activity within 3 days.
Vitest supports
toContain
withclassList
since 1.0.
I seem to be having the same issue, and we're using Vitest 1.1.3. I'll work on a repo shortly.
Actually, as a follow up, my problem is that toContain
used to work by passing an array of strings expected in the classList. It appears that toContain
how only expects one argument (and not an array), breaking my previous implementation.
Actually, as a follow up, my problem is that
toContain
used to work by passing an array of strings expected in the classList. It appears thattoContain
how only expects one argument (and not an array), breaking my previous implementation.
The reproduction in this issue doesn't use an array. If you think it's a bug, you can open a separate issue with your reproduction. I'd say this is unexpected usage: .toContain
expects an item of the array, not a subset of items (this is how it works in jest). When using chai API you can use expect([1, 2, 3]).to.contain([1, 2])
because it's a separate implementation from Jest.
Describe the bug
I'm using vitest via @storybook/test and want to assert that an element has a certain class. With jest the following worked:
But vitest gives this weird error:
The error message obviously doesn't make sense, because it proposes giving a string instead of a string.
As a workaround the following works in vitest:
Reproduction
I hope the underlying issue is clear enough without a reproduction of this specific instance.
System Info
Used Package Manager
npm
Validations