Questions tagged [testing-library]

Questions about testing JavaScript code with the Testing Library utilities

87 questions
32
votes
1 answer

How to solve the "update was not wrapped in act()" warning in testing-library-react?

I'm working with a simple component that does a side effect. My test passes, but I'm getting the warning Warning: An update to Hello inside a test was not wrapped in act(...).. I'm also don't know if waitForElement is the best way to write this…
5
votes
1 answer

How to use Vue Testing Library with Nuxt.js?

I want to use Vue Testing Library in my Nuxt.js app. But straight after installing the package, launching a test triggers this error: 'vue-cli-service' is not recognized as an internal or external command, operable program or batch file. This is…
drake035
  • 2,935
  • 25
  • 85
  • 161
4
votes
0 answers

Testing svelte components with svelte/store

When testing svelte components, using jest & @testing-library/svelte, the state is shared between tests, is there away to tear down after each test so i have more isolated unit tests. store/theme import { writable } from "svelte/store"; export…
3
votes
1 answer

How to test `contenteditable` events with React Testing Library

I am trying to write tests for one of our rich text components which was implemented with slate js editor in react js. So when writing tests, I am retrieveing the element div[contenteditable='true'], but not able to simulate events like change,…
3
votes
1 answer

How can I test the content in ag-grid using testing-library?

I am trying to write a few simple tests that the headers and data I want to render are showing up as expected. I created a repo - https://github.com/olore/ag-grid-testing-library to reproduce. The table looks as I would expect when opened in a…
olore
  • 3,913
  • 3
  • 21
  • 37
3
votes
3 answers

TypeError: Select is not a constructor when using Svelte and jest

When writing a Jest test for a Svelte component I am getting a TypeError: Select is not a constructor error when the component imports a library using the es6 import syntax. TestSelect.js: