Suppress only the properties Jest probes on Vue instances
What does this MR do and why?
The Jest console watcher ignored every "property is not defined on the instance" render warning. A genuine typo in a template therefore could not fail a spec.
That broad pattern was added to stop Jest's own probing from masking a failing assertion. Two separate layers probe every value in a failing assertion:
| Probed property | Read by |
|---|---|
asymmetricMatch |
expect's equals → isAsymmetric (the comparison, not the diff) |
$$typeof |
pretty-format ReactTestComponent / ReactElement / AsymmetricMatcher |
nodeType, tagName, hasAttribute |
pretty-format DOMElement |
@@__IMMUTABLE_ITERABLE__@@, @@__IMMUTABLE_RECORD__@@ |
pretty-format Immutable |
toJSON |
pretty-format printer |
A Vue instance answers through its render proxy, so it warns about each unknown property. The watcher throws on the first warning, so the assertion's real expected/received values never reach the terminal.
It also closes a Vue 3 hole
Vue 3 warns from its ownKeys proxy trap when Jest enumerates the instance:
[Vue warn]: Avoid app logic that relies on enumerating keys on a component instance.No pattern matched that wording, so on master a failing assertion over a Vue
instance is still masked in the Vue 3 lane, only by a different message. This MR
ignores it too.
It also ignores a Pinia quirk that is specific to Vue 3
[Vue warn]: Property "runWithContext" was accessed during render but is not defined on instance.Pinia's Vue 2 plugin overwrites pinia._a with the current component instance on
every new Vue({ pinia }) call. Pinia's own store setup then reads
_a.runWithContext, which no Vue instance defines — but Pinia already falls back to
calling the callback directly in that case, so the warning is cosmetic. No GitLab
code reads a property named runWithContext, so matching this exact name cannot
mask a real defect.
How to reproduce the failures
On master, run the suites this MR fixes:
VUE_VERSION=3 yarn jest \
spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js \
spec/frontend/rapid_diffs/app/init_file_finder_spec.js \
spec/frontend/repository/components/header_area/blob_overflow_menu_spec.js \
spec/frontend/repository/components/header_area/blob_repository_actions_group_spec.js \
spec/frontend/security_configuration/components/secret_push_protection_feature_card_spec.js \
ee/spec/frontend/ai/init_duo_panel_spec.js \
ee/spec/frontend/notes/components/comment_form_spec.js \
ee/spec/frontend/security_orchestration/components/policy_drawer/drawer_wrapper_spec.jsReferences
- Blocked by, the defects this unmasks: #617796 (closed)
- Adds the pattern this MR narrows: !246331 (merged)
- Tracking issue for the remaining blanket suppressions: #396779 (closed)