Add jQuery matchers to Jest
What does this MR do?
Adds the same matchers that we currently have via jasmine-jquery in Karma to Jest.
What are the relevant issue numbers?
closes https://gitlab.com/gitlab-org/gitlab-ce/issues/59637
Before
FAIL spec/frontend/reports/components/report_section_spec.js
● Report section › with success status › toggleCollapsed › toggles issues
TypeError: expect(...).not.toHaveCss is not a function
134 | Vue.nextTick()
135 | .then(() => {
> 136 | expect(vm.$el.querySelector('.js-report-section-container')).not.toHaveCss(hiddenCss);
| ^
137 | expect(vm.$el.querySelector('button').textContent.trim()).toEqual('Collapse');
138 |
139 | vm.$el.querySelector('button').click();
at toHaveCss (spec/frontend/reports/components/report_section_spec.js:136:78)
● Report section › with success status › toggleCollapsed › is always expanded, if always-open is set to true
TypeError: expect(...).not.toHaveCss is not a function
152 | Vue.nextTick()
153 | .then(() => {
> 154 | expect(vm.$el.querySelector('.js-report-section-container')).not.toHaveCss(hiddenCss);
| ^
155 | expect(vm.$el.querySelector('button')).toBeNull();
156 | })
157 | .then(done)
at toHaveCss (spec/frontend/reports/components/report_section_spec.js:154:78)
(https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/187950242)
After
PASS spec/frontend/reports/components/report_section_spec.js
(https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/188063673)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process. -
Security reports checked/validated by reviewer
Edited by Inactive Account