Repository navigation
fix: clear events emitted during unmount from the emitted history - #2985
Merged
cexbrayat merged 1 commit intoOct 26, 2026
Merged
Conversation
The emit recorder stays active while the app unmounts, so clearing the history before app.unmount() let beforeUnmount emits repopulate it with entries nothing ever released.
✅ Deploy Preview for vue-test-utils-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
virgilchiriac
added a commit
to hpi-schul-cloud/nuxt-client
that referenced
this pull request
Dec 1, 2026
@vue/test-utils 2.6.0 has two changes in behaviour that broke tests: - wrapper.unmount() clears the emitted history after unmounting (vuejs/test-utils#2985), so events emitted in onBeforeUnmount are lost. The tests of LinkContentElementCreate and VideoConferenceContentElementCreate check them with listener spies. - Props passed to mount() are no longer deeply reactive (vuejs/test-utils#2951). RoomForm changes its room prop in place, so the test wraps the room in reactive(), as the parent pages pass a ref. Co-authored-by: Copilot <[email protected]>
madebyzan
added a commit
to madebyzan/knovum
that referenced
this pull request
Dec 3, 2026
v2.6.0 clears events emitted during unmount from the emitted history (vuejs/test-utils#2985), so assert the busy:false release via the instance emit spy instead of emitted() after unmount.
madebyzan
added a commit
to madebyzan/knovum
that referenced
this pull request
Dec 3, 2026
@vue/test-utils v2.6.0 clears events emitted during unmount from the emitted history (vuejs/test-utils#2985), so assert the busy:false release via the instance emit spy instead of emitted() after unmount.
virgilchiriac
added a commit
to hpi-schul-cloud/nuxt-client
that referenced
this pull request
Dec 3, 2026
@vue/test-utils 2.6.0 has two changes in behaviour that broke tests: - wrapper.unmount() clears the emitted history after unmounting (vuejs/test-utils#2985), so events emitted in onBeforeUnmount are lost. The tests of LinkContentElementCreate and VideoConferenceContentElementCreate check them with listener spies. - Props passed to mount() are no longer deeply reactive (vuejs/test-utils#2951). RoomForm changes its room prop in place, so the test wraps the room in reactive(), as the parent pages pass a ref.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wrapper.unmount()clears the recorded emit history before it unmounts the app, but the devtools recording hook is still installed at that point. Anyemit()that runs during teardown — fromonBeforeUnmount, a watcher cleanup, an effect scope stop — goes back throughrecordEventand recreates theevents[uid]andrecordedUidsByRoot[rootUid]entries that were just deleted. Nothing removes them afterwards, so when the payload is a DOM/custom event the detached DOM tree, the component instance and the app stay reachable for the lifetime of the module (the whole worker withisolate: false).In
VueWrapper.unmount()(src/vueWrapper.ts) theremoveEventHistory(this.vm)call now runs afterthis.__app.unmount(), inside afinallyso the history is still dropped if unmounting throws, as it was before.vm.$.root.uidis still readable after unmount, soremoveEventHistoryresolves the same root bucket and clears every uid recorded under it, including the ones added during teardown. Emits fromonUnmountedwere already dropped by Vue itself (instance.isUnmounted), so this only concerns thebeforeUnmountphase.This follows up on #2898, which introduced the
recordedUidsByRootmap to clear child histories on unmount.Note the one behaviour change: a test that reads
wrapper.emitted('x')afterunmount()to assert a teardown emit now getsundefinedand needs a listener spy ({ onX: spy }) instead. Emits from before the unmount were already cleared, so keeping the ones from during it was accidental.fix #2984