290 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
0
answers
89
views
Problem with toHaveBeenCalledWith called from window object
This is my unit test:
import '@testing-library/jest-dom/extend-expect';
import {
render,
cleanup,
fireEvent,
waitFor,
waitForElementToBeRemoved,
screen,
} from '@testing-library/svelte';
...
0
votes
1
answer
83
views
testing an useState change inside a callback
I have a component like this to test:
import {doSomethingMocked} form 'mockedLibrary';
const TheComponent = (props) => {
const [isToTest, setIsToTest] = useState(false);
const handleClick = ...
0
votes
1
answer
53
views
Global propery in JSDOM not being set in integration test (angular-testing-library)
I'm not able to set up my testing-library integration tests so they recognize the global interface with the third party static methods from my component library Preline UI
I'm using JSDOM and angular-...
2
votes
0
answers
141
views
React 18.3 causes a lot of `act` warnings in tests
I have the following component - "A toggle button":
// ToggleButton.tsx
export function ToggleButton() {
const [isEnabled, setIsEnabled] = React.useState(true);
return (
<button
...
1
vote
1
answer
87
views
Testing library on ionic angular - Cannot find module '@angular/animations/browser'
I'm trying to use jest and testing library with angular 17
When I run tests, I get :
Cannot find module '@angular/animations/browser' from 'node_modules/@angular/platform-browser/fesm2022/...
0
votes
1
answer
110
views
React Unit Test Not Able to Find an Element with Using Async Act
I am testing user click interaction with using Jest and RTL in my React app. Component states are updating with user interaction, i.e., a click event.
My component has one combo box. When clicked, it ...
1
vote
1
answer
199
views
It is possible to improve even more?
I have a big React app with 4205 Jest test running in a CI and it is taking more than 40 minutes to run all the tests. This amount of time is normal?
Versions:
NPM: 7.24.0
Node: 16.10.0
@testing-...
1
vote
0
answers
278
views
I'm getting an error when running tests with jest and remix
I'm getting an error when running tests with jest and remix
I'm trying to set up a project using remix and I took the test I saw in the doc as an example to test in the project and I'm getting an ...
-1
votes
1
answer
28
views
How to limit testing-library `within` to only first-generation children?
I have a two-level nested list structure as follows:
<ul data-testid="parentList">
<li>First parent
<ul>
<li>Child of first parent</li>
</...
0
votes
1
answer
1k
views
jest-dom installed but @testing-library looking for dom
I installed jest, jest-environment-jsdom, @testing-library/react and @testing-library/jest-dom, as suggested on the Next.js site.
However, I am unable to run any test that involves working with the ...
0
votes
1
answer
227
views
Testing a [sometimes] empty React component with testing-library
I have a React component that renders a series of buttons -- unless the user has turned off the setting, in which case it returns an empty component (<></>). I'm having trouble writing ...
3
votes
1
answer
333
views
Unit testing code that fires at the end of the intro animation in Svelte
I created a Svelte component that is meant to show quickly and then disappear, merely to communicate that the action took place and how many records were touched by the action.
The component is very ...
1
vote
1
answer
6k
views
How to blur an input field using Testing Library UserEvent?
How can I blur an input field using @testing-library/user-event? I know there's fireEvent.blur, but is there an alternative with userEvent?
2
votes
1
answer
1k
views
`Cannot use 'in' operator to search for '_leaflet_id' in null` in testing
I am implementing an integration test with Vitest 1.4.0 and testing-library/react 14.2.1 which renders the main app component. Simply by calling the testing-library render() function, I get this error:...
0
votes
1
answer
89
views
Svelte Kit using Testing Library not recognising href value
I am setting up some tests for a Svelte Kit project using Testing Library which are checking for the presence of HTML elements and subsequent values. At the moment I am writing these tests for my ...