-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Note: I'm experiencing a similar issue as found here https://stackoverflow.com/questions/69538390/jest-not-exiting-properly-when-using-rtk-query-uselazyquery-with-reactnative
ISSUE
When I have a component that uses useLazyQuery
in jest
. I think the caching behaviour causes issues in jest
because the the promise does not finish.
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
I have solved it following the example mentioned in the above link:
const api = createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({
baseUrl: 'any-base-url',
}),
keepUnusedDataFor: process.env.NODE_ENV === 'test' ? 0 : 60, // <- here
endpoints: () => {
return {
// your endpoints
};
},
});
Wondering if this is a bug or if this is expected?
Metadata
Metadata
Assignees
Labels
No labels