Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: local types, supporting jest, @jest/globals, vitest #511

Merged
merged 3 commits into from
Aug 13, 2023

Conversation

jgoz
Copy link
Collaborator

@jgoz jgoz commented Aug 12, 2023

What:

Moves matcher types back into this package and adds support for @jest/globals and vitest, both in terms of automatically extending expect and augmenting the appropriate TypeScript interfaces.

There are three breaking changes here:

  1. Drop support for node < 14
  2. Removes the extend-expect script. Users should use the default import path or one of the new test platform-specific paths to automatically extend the appropriate "expect" instance. extend-expect was not documented in the Readme, so this change should have minimal impact.
  3. Remove the @types/ dependency. This might affect JavaScript users who were relying on the automatic inclusion of the @types/ package to get auto-complete in their editor for jest-dom assertions.

But in my local testing with the changes in this PR, following the Readme was sufficient to get full auto-complete support even for JS-only users. As long as they have a jest-setup file that imports the bare export and add a dependency on @types/jest, recent versions of VS Code will figure it out.

In addition to the above changes, @jest/globals and vitest users can now use jest-dom without caveats. Users can now use the following import paths to automatically extend "expect" for their chosen test platform:

  • @testing-library/jest-dom — jest+@types/jest
  • @testing-library/jest-dom/jest-globals — @jest/globals
  • @testing-library/jest-dom/vitest — vitest

For example:

import '@testing-library/jest-dom/jest-globals'

Importing from one of the above paths will augment the appropriate matcher interface for the given test platform, assuming the import is done in a .ts file that is included in the user's tsconfig.json.

It's also (still) possible to import the matchers directly without side effects:

import * as matchers from '@testing-library/jest-dom/matchers'

Why:

There have been numerous issues filed over the last couple years as the JS testing ecosystem has evolved and users wanted to use this library in more environments. It was usually possible, thanks to broad compatibility efforts in the ecosystem at large, but using jest-dom outside of Jest was not always straightforward.

Originally, moving the types to DT was in service of a noble "it should just work" goal, but in practice, it traded convenience in simple cases for confusion in more complex cases. It also broke with convention around DT packages — why does the actual package have a dependency on its own types? Why not simply move the types into the package? Those were valid questions that had legitimate answers, but they grew stale with time.

Fixes #314
Fixes #427
Closes #472
Fixes #506
Fixes #476
Closes #484
Closes #496
Closes #483
Closes #460

How:

  • Move latest typings from @types/testing-library__jest-dom into this repo
  • Add jest.d.ts for extending global interfaces when using @types/jest
  • Add jest-globals.d.ts for extending interfaces when using @jest/config
  • Add vitest.d.ts for extending interfaces when using vitest
  • Add optional peer dependencies on jest, @types/jest, @jest/globals, and vitest
  • Add /jest-globals and /vitest exports for automatically extending @jest/globals and vitest, respectively

Checklist:

  • Documentation
  • Tests
  • Updated Type Definitions
  • Ready to be merged

Moves matcher types back into this package and adds support for
@jest/globals and vitest.

BREAKING CHANGE: Removes the extend-expect script. Users should use
the default import path or one of the new test platform-specific
paths to automatically extend the appropriate "expect" instance.

extend-expect was not documented in the Readme, so this change should
have minimal impact.

Users can now use the following import paths to automatically extend
"expect" for their chosen test platform:

- @testing-library/jest-dom - jest (@types/jest)
- @testing-library/jest-dom/jest-globals - @jest/globals
- @testing-library/jest-dom/vitest - vitest

For example:

import '@testing-library/jest-dom/jest-globals'

Importing from one of the above paths will augment the appropriate
matcher interface for the given test platform, assuming the import
is done in a .ts file that is included in the user's tsconfig.json.

It's also (still) possible to import the matchers directly without
side effects:

import * as matchers from '@testing-library/jest-dom/matchers'
@jgoz jgoz requested review from gnapse, nickserv and kentcdodds August 12, 2023 18:42
@@ -0,0 +1,4 @@
const globals = require('@jest/globals')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, @jest/globals had to use CommonJS

@@ -0,0 +1,4 @@
import {expect} from 'vitest'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And Vitest only supports ESM 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, should this file extension be .mjs?

Have you test this setup in a vitest project? If not, could you verify this will work as expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question. Using .mjs would be technically correct, but then all imported files would need to be ESM, which is not the case for matchers.js. Basically, vitest fails with "Error: Cannot find module".

I think we could change the extension after dual-publishing ES (#437?), but for now this works in vitest.

Have you test this setup in a vitest project?

Yeah, I've got 4 test projects that I tested this PR against: Jest+JS, Jest+TS, @jest/globals+TS, vitest+TS. I'll publish them soon.

@@ -0,0 +1 @@
/// <reference path="types/vitest.d.ts" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A combination of <reference> and export {} in the referenced definitions seemed to be required to get TypeScript to augment the appropriate interfaces when this file was imported from node_modules.

@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Merging #511 (85dbd5b) into main (d717c66) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #511   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines          664       664           
  Branches       251       251           
=========================================
  Hits           664       664           
Files Changed Coverage Δ
src/to-be-in-the-document.js 100.00% <ø> (ø)
src/to-contain-element.js 100.00% <ø> (ø)
src/to-contain-html.js 100.00% <ø> (ø)
src/utils.js 100.00% <ø> (ø)
src/index.js 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jgoz jgoz mentioned this pull request Aug 12, 2023
4 tasks
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for doing this work! I think it's going to be a very positive thing. I just have a couple questions.

@@ -144,6 +180,18 @@ haven't already:
],
```

### With another Jest-compatible `expect`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be the approach if you're not using vitest's globals.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure what you mean by vitest's globals. Vitest's default mode is globals: false, which requires explicit imports of describe, expect, etc., and the new vitest entrypoint is designed to work with that. I didn't actually think to test with globals: true and importing the vitest/globals types — I'll do that tomorrow.

This section was intended as a hedge against future testing libraries that might emerge that retain some level of compatibility with Jest. But if you think it might be more confusing than helpful, I'm happy to remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't actually think to test with globals: true and importing the vitest/globals types — I'll do that tomorrow.

Tested this and it works.

@@ -0,0 +1,4 @@
import {expect} from 'vitest'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, should this file extension be .mjs?

Have you test this setup in a vitest project? If not, could you verify this will work as expected?

@kentcdodds kentcdodds merged commit 4b764b9 into testing-library:main Aug 13, 2023
@kentcdodds
Copy link
Member

Thank you so much for helping with this!

@github-actions
Copy link

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@MattyBalaam
Copy link

Very happy to see this 😊

@TrevorBurnham
Copy link

Really excited to see this! FYI when I first plugged in this change (upgrading @testing-library/jest-dom from 5.16.5 to 6.0.0, upgrading vitest from 0.30.1 to 0.34.1 to fix a compatibility issue, then dropping @types/testing-library__jest-dom and adding import "@testing-library/jest-dom/vitest" to my test setup file), I got this error when running my tests:

Error: @vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201

No idea why that happened, but the error went away when I upgraded @vitejs/plugin-react from 3.1.0 to 4.0.4. Sharing this in hopes that it saves other devs some headaches. 🙏🏻

jtoar added a commit to redwoodjs/redwood that referenced this pull request Dec 15, 2023
This reverts #9673 and
#9711.

With v6 of `@testing-library/jest-dom`, `yarn rw type-check` fails in
Redwood projects because it can't locate the types for
`@testing-libary/jest-dom`. They absorbed the definitely types package
(`@types/testing-library__jest-dom`) in this PR:
testing-library/jest-dom#511. Here's an example
of a failing run:
https://github.com/redwoodjs/redwood/actions/runs/7213177056/job/19668365614?pr=9708.

The logical thing to do is remove `@testing-libary/jest-dom` from the
`types` array in `web/tsconfig.json`, but when we do that we get a
different failure from TS saying that it doesn't understand the extended
matchers provided by `testing-library/jest-dom` like
`toBeInTheDocument`.

@Tobbe filed an issue in their repo here
testing-library/jest-dom#559.

In the PR I linked to, the maintainer notes that...

> But in my local testing with the changes in this PR, following the
Readme was sufficient to get full auto-complete support even for JS-only
users. As long as they have a jest-setup file that imports the bare
export and add a dependency on @types/jest, recent versions of VS Code
will figure it out.

Users don't have jest setup files in their project (we just point to a
jest preset) or `@types/jest` as an explicit dev dependency.

I took a look at it but couldn't crack it today. Instead of holding up
other PRs in CI, better to revert it for now and come back to later when
we have more leads.
sungik-choi added a commit to channel-io/bezier-react that referenced this pull request Feb 27, 2024
<!--
  How to write a good PR title:
- Follow [the Conventional Commits
specification](https://www.conventionalcommits.org/en/v1.0.0/).
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

## Self Checklist

- [x] I wrote a PR title in **English** and added an appropriate
**label** to the PR.
- [x] I wrote the commit message in **English** and to follow [**the
Conventional Commits
specification**](https://www.conventionalcommits.org/en/v1.0.0/).
- [x] I [added the
**changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md)
about the changes that needed to be released. (or didn't have to)
- [x] I wrote or updated **documentation** related to the changes. (or
didn't have to)
- [x] I wrote or updated **tests** related to the changes. (or didn't
have to)
- [x] I tested the changes in various browsers. (or didn't have to)
  - Windows: Chrome, Edge, (Optional) Firefox
  - macOS: Chrome, Edge, Safari, (Optional) Firefox

## Summary
<!-- Please brief explanation of the changes made -->

Rollup(#1674), eslint, typescript(채널 lint 설정이 최신화되지 않음)을 제외한 라이브러리들을 최신
버전으로 업데이트합니다.

## Details
<!-- Please elaborate description of the changes -->

- 업데이트 과정에서 발생한 타입 충돌 등을 해결했습니다. 레퍼런스 및 커밋을 참고해주세요.
- browserlist를 업데이트했습니다. 정확한 연유는 모르겠으나, 업그레이드 이후 `postcss-preset-env` 에
의해 cascade layer, `:has` 등의 모던 CSS 기능들이 빌드 과정에서 제거되는 현상이 발생했습니다. 가장 좁은
브라우저 커버리지를 가지는 `:has` 기준으로 브라우저 리스트를 별도 파일로 분리하고, 주석을 추가했습니다.
- `yarn dedupe` 를 실행하여 중복 패키지 버전을 최소화하도록 했습니다.

### Breaking change? (Yes/No)
<!-- If Yes, please describe the impact and migration path for users -->

No

## References
<!-- Please list any other resources or points the reviewer should be
aware of -->

- ~~https://storybook.js.org/blog/optimize-storybook-7-6/ : 스토리북 빌드 시
babel대신 swc를 사용하도록 하는 설정을 추가~~
- testing-library/jest-dom#511 :
testing-library가 @types를 포함하지 않도록 변경되면서, tsconfig에 jest config 파일을 추가
- [브라우저
커버리지](https://browsersl.ist/#q=%3E%3D+1%25+in+KR%2C%0A%3E%3D+1%25+in+JP%2C%0A%3E%3D+1%25+in+US%2C%0Anot+dead%2C%0AChrome+%3E%3D+105%2C%0AEdge+%3E%3D+105%2C%0Anot+Edge+%3C+105%2C%0AFirefox+%3E%3D+121%2C%0AiOS+%3E%3D+15.4%2C%0ASafari+%3E%3D+15.4%2C%0AAndroid+%3E%3D+121%2C%0AOpera+%3E%3D+91%0ASamsung+%3E%3D+20&region=KR).
기존 브라우저 커버리지보다 커버리지가 높습니다.
zemnmez-renovate-bot added a commit to zemn-me/monorepo that referenced this pull request Oct 5, 2024
##### [`v6.5.0](https://github.com/testing-library/jest-dom/releases/tag/v6.5.0)

##### Features

-   **toHaveValue:** Asserting aria-valuenow ([#479](testing-library/jest-dom#479)) ([acbf416](testing-library/jest-dom@acbf416))
##### [`v6.4.8](https://github.com/testing-library/jest-dom/releases/tag/v6.4.8)

##### Bug Fixes

-   Drop peerDependencies from package.json ([#610](testing-library/jest-dom#610)) ([faf534b](testing-library/jest-dom@faf534b))
##### [`v6.4.7](https://github.com/testing-library/jest-dom/releases/tag/v6.4.7)

##### Bug Fixes

-   Type definition of `toHaveClass` ([#611](testing-library/jest-dom#611)) ([5cc6298](testing-library/jest-dom@5cc6298))
##### [`v6.4.6](https://github.com/testing-library/jest-dom/releases/tag/v6.4.6)

##### Bug Fixes

-   Support [@starting-style](https://github.com/starting-style) ([#602](testing-library/jest-dom#602)) ([fd9ee68](testing-library/jest-dom@fd9ee68))
##### [`v6.4.5](https://github.com/testing-library/jest-dom/releases/tag/v6.4.5)

##### Bug Fixes

-   add js suffix to isEqualWith import ([#599](testing-library/jest-dom#599)) ([e8c8b13](testing-library/jest-dom@e8c8b13))
##### [`v6.4.4](https://github.com/testing-library/jest-dom/releases/tag/v6.4.4)

##### Bug Fixes

-   **infra:** codecoverage token addition ([#600](testing-library/jest-dom#600)) ([f03a582](testing-library/jest-dom@f03a582))
##### [`v6.4.3](https://github.com/testing-library/jest-dom/releases/tag/v6.4.3)

##### Bug Fixes

-   Updates role support for aria-required attribute in `toBeRequired` ([#590](testing-library/jest-dom#590)) ([20aca33](testing-library/jest-dom@20aca33))
##### [`v6.4.2](https://github.com/testing-library/jest-dom/releases/tag/v6.4.2)

##### Bug Fixes

-   Remove errant export of GetByRoleMatcher, fixing type checking in some TS configurations ([#575](testing-library/jest-dom#575)) ([a93c0c4](testing-library/jest-dom@a93c0c4))
##### [`v6.4.1](https://github.com/testing-library/jest-dom/releases/tag/v6.4.1)

##### Bug Fixes

-   Export type `TestingLibraryMatchers` from "./matchers" ([#576](testing-library/jest-dom#576)) ([dd1c4dd](testing-library/jest-dom@dd1c4dd))
##### [`v6.4.0](https://github.com/testing-library/jest-dom/releases/tag/v6.4.0)

##### Features

-   Add toHaveRole matcher ([#572](testing-library/jest-dom#572)) ([f7dc673](testing-library/jest-dom@f7dc673))
##### [`v6.3.0](https://github.com/testing-library/jest-dom/releases/tag/v6.3.0)

##### Features

-   Support for regular expressions in toHaveClass ([#563](testing-library/jest-dom#563)) ([9787ed5](testing-library/jest-dom@9787ed5))
##### [`v6.2.1](https://github.com/testing-library/jest-dom/releases/tag/v6.2.1)

##### Bug Fixes

-   Standalone types for "./matchers" export and add Bun support ([#566](testing-library/jest-dom#566)) ([5675b86](testing-library/jest-dom@5675b86))
##### [`v6.2.0](https://github.com/testing-library/jest-dom/releases/tag/v6.2.0)

##### Features

-   toHaveAccessibleDescription supports aria-description ([#565](testing-library/jest-dom#565)) ([1fb156c](testing-library/jest-dom@1fb156c))
##### [`v6.1.6](https://github.com/testing-library/jest-dom/releases/tag/v6.1.6)

##### Bug Fixes

-   Upgrade [@adobe/css-tools](https://github.com/adobe/css-tools) to v4.3.2 ([#553](testing-library/jest-dom#553)) ([b64b953](testing-library/jest-dom@b64b953))
##### [`v6.1.5](https://github.com/testing-library/jest-dom/releases/tag/v6.1.5)

##### Bug Fixes

-   support uppercase custom props in toHaveStyle ([#552](testing-library/jest-dom#552)) ([b7b7c6a](testing-library/jest-dom@b7b7c6a))
##### [`v6.1.4](https://github.com/testing-library/jest-dom/releases/tag/v6.1.4)

##### Bug Fixes

-   upgrade `@adobe/css-tools` to `4.3.1` to address vulnerability ([#532](testing-library/jest-dom#532)) ([44f1eab](testing-library/jest-dom@44f1eab))
##### [`v6.1.3](https://github.com/testing-library/jest-dom/releases/tag/v6.1.3)

##### Bug Fixes

-   proper [@jest/globals](https://github.com/jest/globals) import ([#530](testing-library/jest-dom#530)) ([5b492ac](testing-library/jest-dom@5b492ac))
##### [`v6.1.2](https://github.com/testing-library/jest-dom/releases/tag/v6.1.2)

##### Bug Fixes

-   bump [@adobe/css-tools](https://github.com/adobe/css-tools) for ESM support ([#525](testing-library/jest-dom#525)) ([b959a68](testing-library/jest-dom@b959a68))
##### [`v6.1.1](https://github.com/testing-library/jest-dom/releases/tag/v6.1.1)

##### Bug Fixes

-   **package.json:** update main and module file paths ([#523](testing-library/jest-dom#523)) ([853a3e5](testing-library/jest-dom@853a3e5))
##### [`v6.1.0](https://github.com/testing-library/jest-dom/releases/tag/v6.1.0)

##### Features

-   Publish ESM and CJS (testing-library/jest-dom#519)
##### [`v6.0.1](https://github.com/testing-library/jest-dom/releases/tag/v6.0.1)

##### Bug Fixes

-   matchers type is making the global expect unsafe ([#513](testing-library/jest-dom#513)) ([bdb34f1](testing-library/jest-dom@bdb34f1))
##### [`v6.0.0](https://github.com/testing-library/jest-dom/releases/tag/v6.0.0)

##### Features

-   local types, supporting jest, [@jest/globals](https://github.com/jest/globals), vitest ([#511](testing-library/jest-dom#511)) ([4b764b9](testing-library/jest-dom@4b764b9))

##### BREAKING CHANGES

-   Removes the extend-expect script. Users should use
    the default import path or one of the new test platform-specific
    paths to automatically extend the appropriate "expect" instance.

extend-expect was not documented in the Readme, so this change should
have minimal impact.

Users can now use the following import paths to automatically extend
"expect" for their chosen test platform:

-   [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) - jest ([@types/jest](https://github.com/types/jest))
-   @testing-library/jest-dom/jest-globals - [@jest/globals](https://github.com/jest/globals)
-   @testing-library/jest-dom/vitest - vitest

For example:

import '@testing-library/jest-dom/jest-globals'

Importing from one of the above paths will augment the appropriate
matcher interface for the given test platform, assuming the import
is done in a .ts file that is included in the user's tsconfig.json.

It's also (still) possible to import the matchers directly without
side effects:

import \* as matchers from '@testing-library/jest-dom/matchers'

-   Update kcd-scripts
-   Drop node < 14
github-merge-queue bot pushed a commit to zemn-me/monorepo that referenced this pull request Oct 5, 2024
##### [`v6.5.0](https://github.com/testing-library/jest-dom/releases/tag/v6.5.0)

##### Features

-   **toHaveValue:** Asserting aria-valuenow ([#479](testing-library/jest-dom#479)) ([acbf416](testing-library/jest-dom@acbf416))
##### [`v6.4.8](https://github.com/testing-library/jest-dom/releases/tag/v6.4.8)

##### Bug Fixes

-   Drop peerDependencies from package.json ([#610](testing-library/jest-dom#610)) ([faf534b](testing-library/jest-dom@faf534b))
##### [`v6.4.7](https://github.com/testing-library/jest-dom/releases/tag/v6.4.7)

##### Bug Fixes

-   Type definition of `toHaveClass` ([#611](testing-library/jest-dom#611)) ([5cc6298](testing-library/jest-dom@5cc6298))
##### [`v6.4.6](https://github.com/testing-library/jest-dom/releases/tag/v6.4.6)

##### Bug Fixes

-   Support [@starting-style](https://github.com/starting-style) ([#602](testing-library/jest-dom#602)) ([fd9ee68](testing-library/jest-dom@fd9ee68))
##### [`v6.4.5](https://github.com/testing-library/jest-dom/releases/tag/v6.4.5)

##### Bug Fixes

-   add js suffix to isEqualWith import ([#599](testing-library/jest-dom#599)) ([e8c8b13](testing-library/jest-dom@e8c8b13))
##### [`v6.4.4](https://github.com/testing-library/jest-dom/releases/tag/v6.4.4)

##### Bug Fixes

-   **infra:** codecoverage token addition ([#600](testing-library/jest-dom#600)) ([f03a582](testing-library/jest-dom@f03a582))
##### [`v6.4.3](https://github.com/testing-library/jest-dom/releases/tag/v6.4.3)

##### Bug Fixes

-   Updates role support for aria-required attribute in `toBeRequired` ([#590](testing-library/jest-dom#590)) ([20aca33](testing-library/jest-dom@20aca33))
##### [`v6.4.2](https://github.com/testing-library/jest-dom/releases/tag/v6.4.2)

##### Bug Fixes

-   Remove errant export of GetByRoleMatcher, fixing type checking in some TS configurations ([#575](testing-library/jest-dom#575)) ([a93c0c4](testing-library/jest-dom@a93c0c4))
##### [`v6.4.1](https://github.com/testing-library/jest-dom/releases/tag/v6.4.1)

##### Bug Fixes

-   Export type `TestingLibraryMatchers` from "./matchers" ([#576](testing-library/jest-dom#576)) ([dd1c4dd](testing-library/jest-dom@dd1c4dd))
##### [`v6.4.0](https://github.com/testing-library/jest-dom/releases/tag/v6.4.0)

##### Features

-   Add toHaveRole matcher ([#572](testing-library/jest-dom#572)) ([f7dc673](testing-library/jest-dom@f7dc673))
##### [`v6.3.0](https://github.com/testing-library/jest-dom/releases/tag/v6.3.0)

##### Features

-   Support for regular expressions in toHaveClass ([#563](testing-library/jest-dom#563)) ([9787ed5](testing-library/jest-dom@9787ed5))
##### [`v6.2.1](https://github.com/testing-library/jest-dom/releases/tag/v6.2.1)

##### Bug Fixes

-   Standalone types for "./matchers" export and add Bun support ([#566](testing-library/jest-dom#566)) ([5675b86](testing-library/jest-dom@5675b86))
##### [`v6.2.0](https://github.com/testing-library/jest-dom/releases/tag/v6.2.0)

##### Features

-   toHaveAccessibleDescription supports aria-description ([#565](testing-library/jest-dom#565)) ([1fb156c](testing-library/jest-dom@1fb156c))
##### [`v6.1.6](https://github.com/testing-library/jest-dom/releases/tag/v6.1.6)

##### Bug Fixes

-   Upgrade [@adobe/css-tools](https://github.com/adobe/css-tools) to v4.3.2 ([#553](testing-library/jest-dom#553)) ([b64b953](testing-library/jest-dom@b64b953))
##### [`v6.1.5](https://github.com/testing-library/jest-dom/releases/tag/v6.1.5)

##### Bug Fixes

-   support uppercase custom props in toHaveStyle ([#552](testing-library/jest-dom#552)) ([b7b7c6a](testing-library/jest-dom@b7b7c6a))
##### [`v6.1.4](https://github.com/testing-library/jest-dom/releases/tag/v6.1.4)

##### Bug Fixes

-   upgrade `@adobe/css-tools` to `4.3.1` to address vulnerability ([#532](testing-library/jest-dom#532)) ([44f1eab](testing-library/jest-dom@44f1eab))
##### [`v6.1.3](https://github.com/testing-library/jest-dom/releases/tag/v6.1.3)

##### Bug Fixes

-   proper [@jest/globals](https://github.com/jest/globals) import ([#530](testing-library/jest-dom#530)) ([5b492ac](testing-library/jest-dom@5b492ac))
##### [`v6.1.2](https://github.com/testing-library/jest-dom/releases/tag/v6.1.2)

##### Bug Fixes

-   bump [@adobe/css-tools](https://github.com/adobe/css-tools) for ESM support ([#525](testing-library/jest-dom#525)) ([b959a68](testing-library/jest-dom@b959a68))
##### [`v6.1.1](https://github.com/testing-library/jest-dom/releases/tag/v6.1.1)

##### Bug Fixes

-   **package.json:** update main and module file paths ([#523](testing-library/jest-dom#523)) ([853a3e5](testing-library/jest-dom@853a3e5))
##### [`v6.1.0](https://github.com/testing-library/jest-dom/releases/tag/v6.1.0)

##### Features

-   Publish ESM and CJS (testing-library/jest-dom#519)
##### [`v6.0.1](https://github.com/testing-library/jest-dom/releases/tag/v6.0.1)

##### Bug Fixes

-   matchers type is making the global expect unsafe ([#513](testing-library/jest-dom#513)) ([bdb34f1](testing-library/jest-dom@bdb34f1))
##### [`v6.0.0](https://github.com/testing-library/jest-dom/releases/tag/v6.0.0)

##### Features

-   local types, supporting jest, [@jest/globals](https://github.com/jest/globals), vitest ([#511](testing-library/jest-dom#511)) ([4b764b9](testing-library/jest-dom@4b764b9))

##### BREAKING CHANGES

-   Removes the extend-expect script. Users should use
    the default import path or one of the new test platform-specific
    paths to automatically extend the appropriate "expect" instance.

extend-expect was not documented in the Readme, so this change should
have minimal impact.

Users can now use the following import paths to automatically extend
"expect" for their chosen test platform:

-   [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) - jest ([@types/jest](https://github.com/types/jest))
-   @testing-library/jest-dom/jest-globals - [@jest/globals](https://github.com/jest/globals)
-   @testing-library/jest-dom/vitest - vitest

For example:

import '@testing-library/jest-dom/jest-globals'

Importing from one of the above paths will augment the appropriate
matcher interface for the given test platform, assuming the import
is done in a .ts file that is included in the user's tsconfig.json.

It's also (still) possible to import the matchers directly without
side effects:

import \* as matchers from '@testing-library/jest-dom/matchers'

-   Update kcd-scripts
-   Drop node < 14
CrispyBaguette pushed a commit to CrispyBaguette/wasm-palette-converter that referenced this pull request Nov 8, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) | dependencies | major | [`^5.16.4` -> `^6.0.0`](https://renovatebot.com/diffs/npm/@testing-library%2fjest-dom/5.17.0/6.6.3) |

---

### Release Notes

<details>
<summary>testing-library/jest-dom (@&#8203;testing-library/jest-dom)</summary>

### [`v6.6.3`](https://github.com/testing-library/jest-dom/releases/tag/v6.6.3)

[Compare Source](testing-library/jest-dom@v6.6.2...v6.6.3)

##### Bug Fixes

-   add vitest import when extending vitest matchers ([#&#8203;646](testing-library/jest-dom#646)) ([5ba0156](testing-library/jest-dom@5ba0156))

### [`v6.6.2`](https://github.com/testing-library/jest-dom/releases/tag/v6.6.2)

[Compare Source](testing-library/jest-dom@v6.6.1...v6.6.2)

##### Bug Fixes

-   remove recursive type reference in vitest types ([#&#8203;636](testing-library/jest-dom#636)) ([4468378](testing-library/jest-dom@4468378))

### [`v6.6.1`](https://github.com/testing-library/jest-dom/releases/tag/v6.6.1)

[Compare Source](testing-library/jest-dom@v6.6.0...v6.6.1)

##### Bug Fixes

-   fix lodash import in to-have-selection.js ([#&#8203;642](testing-library/jest-dom#642)) ([ced792e](testing-library/jest-dom@ced792e))

### [`v6.6.0`](https://github.com/testing-library/jest-dom/releases/tag/v6.6.0)

[Compare Source](testing-library/jest-dom@v6.5.0...v6.6.0)

##### Features

-   implement toHaveSelection ([#&#8203;637](testing-library/jest-dom#637)) ([9b14804](testing-library/jest-dom@9b14804))

### [`v6.5.0`](https://github.com/testing-library/jest-dom/releases/tag/v6.5.0)

[Compare Source](testing-library/jest-dom@v6.4.8...v6.5.0)

##### Features

-   **toHaveValue:** Asserting aria-valuenow ([#&#8203;479](testing-library/jest-dom#479)) ([acbf416](testing-library/jest-dom@acbf416))

### [`v6.4.8`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.8)

[Compare Source](testing-library/jest-dom@v6.4.7...v6.4.8)

##### Bug Fixes

-   Drop peerDependencies from package.json ([#&#8203;610](testing-library/jest-dom#610)) ([faf534b](testing-library/jest-dom@faf534b))

### [`v6.4.7`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.7)

[Compare Source](testing-library/jest-dom@v6.4.6...v6.4.7)

##### Bug Fixes

-   Type definition of `toHaveClass` ([#&#8203;611](testing-library/jest-dom#611)) ([5cc6298](testing-library/jest-dom@5cc6298))

### [`v6.4.6`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.6)

[Compare Source](testing-library/jest-dom@v6.4.5...v6.4.6)

##### Bug Fixes

-   Support [@&#8203;starting-style](https://github.com/starting-style) ([#&#8203;602](testing-library/jest-dom#602)) ([fd9ee68](testing-library/jest-dom@fd9ee68))

### [`v6.4.5`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.5)

[Compare Source](testing-library/jest-dom@v6.4.4...v6.4.5)

##### Bug Fixes

-   add js suffix to isEqualWith import ([#&#8203;599](testing-library/jest-dom#599)) ([e8c8b13](testing-library/jest-dom@e8c8b13))

### [`v6.4.4`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.4)

[Compare Source](testing-library/jest-dom@v6.4.3...v6.4.4)

##### Bug Fixes

-   **infra:** codecoverage token addition ([#&#8203;600](testing-library/jest-dom#600)) ([f03a582](testing-library/jest-dom@f03a582))

### [`v6.4.3`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.3)

[Compare Source](testing-library/jest-dom@v6.4.2...v6.4.3)

##### Bug Fixes

-   Updates role support for aria-required attribute in `toBeRequired` ([#&#8203;590](testing-library/jest-dom#590)) ([20aca33](testing-library/jest-dom@20aca33))

### [`v6.4.2`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.2)

[Compare Source](testing-library/jest-dom@v6.4.1...v6.4.2)

##### Bug Fixes

-   Remove errant export of GetByRoleMatcher, fixing type checking in some TS configurations ([#&#8203;575](testing-library/jest-dom#575)) ([a93c0c4](testing-library/jest-dom@a93c0c4))

### [`v6.4.1`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.1)

[Compare Source](testing-library/jest-dom@v6.4.0...v6.4.1)

##### Bug Fixes

-   Export type `TestingLibraryMatchers` from "./matchers" ([#&#8203;576](testing-library/jest-dom#576)) ([dd1c4dd](testing-library/jest-dom@dd1c4dd))

### [`v6.4.0`](https://github.com/testing-library/jest-dom/releases/tag/v6.4.0)

[Compare Source](testing-library/jest-dom@v6.3.0...v6.4.0)

##### Features

-   Add toHaveRole matcher ([#&#8203;572](testing-library/jest-dom#572)) ([f7dc673](testing-library/jest-dom@f7dc673))

### [`v6.3.0`](https://github.com/testing-library/jest-dom/releases/tag/v6.3.0)

[Compare Source](testing-library/jest-dom@v6.2.1...v6.3.0)

##### Features

-   Support for regular expressions in toHaveClass ([#&#8203;563](testing-library/jest-dom#563)) ([9787ed5](testing-library/jest-dom@9787ed5))

### [`v6.2.1`](https://github.com/testing-library/jest-dom/releases/tag/v6.2.1)

[Compare Source](testing-library/jest-dom@v6.2.0...v6.2.1)

##### Bug Fixes

-   Standalone types for "./matchers" export and add Bun support ([#&#8203;566](testing-library/jest-dom#566)) ([5675b86](testing-library/jest-dom@5675b86))

### [`v6.2.0`](https://github.com/testing-library/jest-dom/releases/tag/v6.2.0)

[Compare Source](testing-library/jest-dom@v6.1.6...v6.2.0)

##### Features

-   toHaveAccessibleDescription supports aria-description ([#&#8203;565](testing-library/jest-dom#565)) ([1fb156c](testing-library/jest-dom@1fb156c))

### [`v6.1.6`](https://github.com/testing-library/jest-dom/releases/tag/v6.1.6)

[Compare Source](testing-library/jest-dom@v6.1.5...v6.1.6)

##### Bug Fixes

-   Upgrade [@&#8203;adobe/css-tools](https://github.com/adobe/css-tools) to v4.3.2 ([#&#8203;553](testing-library/jest-dom#553)) ([b64b953](testing-library/jest-dom@b64b953))

### [`v6.1.5`](https://github.com/testing-library/jest-dom/releases/tag/v6.1.5)

[Compare Source](testing-library/jest-dom@v6.1.4...v6.1.5)

##### Bug Fixes

-   support uppercase custom props in toHaveStyle ([#&#8203;552](testing-library/jest-dom#552)) ([b7b7c6a](testing-library/jest-dom@b7b7c6a))

### [`v6.1.4`](https://github.com/testing-library/jest-dom/releases/tag/v6.1.4)

[Compare Source](testing-library/jest-dom@v6.1.3...v6.1.4)

##### Bug Fixes

-   upgrade `@adobe/css-tools` to `4.3.1` to address vulnerability ([#&#8203;532](testing-library/jest-dom#532)) ([44f1eab](testing-library/jest-dom@44f1eab))

### [`v6.1.3`](https://github.com/testing-library/jest-dom/releases/tag/v6.1.3)

[Compare Source](testing-library/jest-dom@v6.1.2...v6.1.3)

##### Bug Fixes

-   proper [@&#8203;jest/globals](https://github.com/jest/globals) import ([#&#8203;530](testing-library/jest-dom#530)) ([5b492ac](testing-library/jest-dom@5b492ac))

### [`v6.1.2`](https://github.com/testing-library/jest-dom/releases/tag/v6.1.2)

[Compare Source](testing-library/jest-dom@v6.1.1...v6.1.2)

##### Bug Fixes

-   bump [@&#8203;adobe/css-tools](https://github.com/adobe/css-tools) for ESM support ([#&#8203;525](testing-library/jest-dom#525)) ([b959a68](testing-library/jest-dom@b959a68))

### [`v6.1.1`](https://github.com/testing-library/jest-dom/releases/tag/v6.1.1)

[Compare Source](testing-library/jest-dom@v6.1.0...v6.1.1)

##### Bug Fixes

-   **package.json:** update main and module file paths ([#&#8203;523](testing-library/jest-dom#523)) ([853a3e5](testing-library/jest-dom@853a3e5))

### [`v6.1.0`](https://github.com/testing-library/jest-dom/releases/tag/v6.1.0)

[Compare Source](testing-library/jest-dom@v6.0.1...v6.1.0)

##### Features

-   Publish ESM and CJS (testing-library/jest-dom#519)

### [`v6.0.1`](https://github.com/testing-library/jest-dom/releases/tag/v6.0.1)

[Compare Source](testing-library/jest-dom@v6.0.0...v6.0.1)

##### Bug Fixes

-   matchers type is making the global expect unsafe ([#&#8203;513](testing-library/jest-dom#513)) ([bdb34f1](testing-library/jest-dom@bdb34f1))

### [`v6.0.0`](https://github.com/testing-library/jest-dom/releases/tag/v6.0.0)

[Compare Source](testing-library/jest-dom@v5.17.0...v6.0.0)

##### Features

-   local types, supporting jest, [@&#8203;jest/globals](https://github.com/jest/globals), vitest ([#&#8203;511](testing-library/jest-dom#511)) ([4b764b9](testing-library/jest-dom@4b764b9))

##### BREAKING CHANGES

-   Removes the extend-expect script. Users should use
    the default import path or one of the new test platform-specific
    paths to automatically extend the appropriate "expect" instance.

extend-expect was not documented in the Readme, so this change should
have minimal impact.

Users can now use the following import paths to automatically extend
"expect" for their chosen test platform:

-   [@&#8203;testing-library/jest-dom](https://github.com/testing-library/jest-dom) - jest ([@&#8203;types/jest](https://github.com/types/jest))
-   @&#8203;testing-library/jest-dom/jest-globals - [@&#8203;jest/globals](https://github.com/jest/globals)
-   @&#8203;testing-library/jest-dom/vitest - vitest

For example:

import '@&#8203;testing-library/jest-dom/jest-globals'

Importing from one of the above paths will augment the appropriate
matcher interface for the given test platform, assuming the import
is done in a .ts file that is included in the user's tsconfig.json.

It's also (still) possible to import the matchers directly without
side effects:

import \* as matchers from '@&#8203;testing-library/jest-dom/matchers'

-   Update kcd-scripts
-   Drop node < 14

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS44LjAiLCJ1cGRhdGVkSW5WZXIiOiIzOS44LjAiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIiLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: https://gitea.bruyant.xyz/alexandre/PaletteSwitcher/pulls/58
Co-authored-by: Renovate <renovate@bruyant.xyz>
Co-committed-by: Renovate <renovate@bruyant.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants