You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to setup test cases with jest, but after the test was finished the process will stalled and does not exit.
Using the command jest --detectOpenHandles will show this error message preventing jest from exiting.
Jest has detected the following 1 open handle potentially keeping Jest from exiting:
● MESSAGEPORT
1 | import { factory, primaryKey } from "@mswjs/data";
2 |
> 3 | const db = factory({
| ^
4 | user: {
5 | userCode: primaryKey(String),
6 | name: String,
at Object.sync (node_modules/.pnpm/@[email protected][email protected]/node_modules/@mswjs/data/lib/extensions/sync.js:69:19)
at factory (node_modules/.pnpm/@[email protected][email protected]/node_modules/@mswjs/data/lib/factory.js:50:12)
at Object.<anonymous> (src/mocks/db.ts:3:19)
at Object.<anonymous> (src/mocks/handlers/user.ts:13:52)
at Object.<anonymous> (src/mocks/server.ts:12:54)
at Object.<anonymous> (src/setupTests.ts:10:17)
I am trying to setup test cases with
jest
, but after the test was finished the process will stalled and does not exit.Using the command
jest --detectOpenHandles
will show this error message preventingjest
from exiting.Actual Code:
After investigation, I found the issue should be related to the unclosed BroadcastChannel 'mswjs/data/sync' in this file:
data/src/extensions/sync.ts
Line 75 in 84d529e
I am suggesting to expose an method for user to manually close the broadcast channel after the test case is completed.
The text was updated successfully, but these errors were encountered: