testing-library / dom-testing-library

πŸ™ Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.26k stars 466 forks source link

test: Improve test perf for suggestion tests #1220

Closed eps1lon closed 1 year ago

eps1lon commented 1 year ago

Brings down the duration of suggestions.js tests from ~9s to <1s.

Was always bugging me how sluggish suggestions.js tests were. Revisited them during https://github.com/testing-library/dom-testing-library/pull/1215/files and it turns out they're only slow because of real timers.

However, the test is not concerned with time but the suggesions themselves. I originally just set the timeout to 1 for find* queries but this felt noisy and means we might regress in the future.

codesandbox-ci[bot] commented 1 year ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 399a184cd200a603732d968af4d8b6d68c5b7daa:

Sandbox Source
react-testing-library-examples Configuration
codecov[bot] commented 1 year ago

Codecov Report

Merging #1220 (399a184) into main (3f64545) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##              main     #1220   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines          992       992           
  Branches       322       322           
=========================================
  Hits           992       992           
Flag Coverage Ξ”
node-14 100.00% <ΓΈ> (ΓΈ)
node-16 100.00% <ΓΈ> (ΓΈ)
node-18 100.00% <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

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