Skip to content

Commit 5d64021

Browse files
committed
✅ 🐛 fix a bug in MessageChannel mock
1 parent 6b5627e commit 5d64021

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,11 @@ function createMessageChannelMock() {
499499

500500
return {
501501
callMessage() {
502-
for (const channel of messageChannels) {
502+
const pendingChannels = [...messageChannels]
503+
504+
messageChannels.splice(0, messageChannels.length)
505+
506+
for (const channel of pendingChannels) {
503507
channel.port1.onmessage?.()
504508
}
505509
},

0 commit comments

Comments
 (0)