summaryrefslogtreecommitdiff
path: root/spec/frontend/test_setup.js
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-04-01 18:55:57 +0000
committerClement Ho <clemmakesapps@gmail.com>2019-04-01 18:55:57 +0000
commite3465a5dde695f316fec13dfde477660b402fdb8 (patch)
treeb55cb313951476d1902764bfcee97266ed594a07 /spec/frontend/test_setup.js
parent57cba4d1e9e9964359a5c55bca6558db0d511d98 (diff)
downloadgitlab-ce-e3465a5dde695f316fec13dfde477660b402fdb8.tar.gz
Add jQuery matchers to Jest
Diffstat (limited to 'spec/frontend/test_setup.js')
-rw-r--r--spec/frontend/test_setup.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js
index 1e3c28e25eb..f09bcb5407e 100644
--- a/spec/frontend/test_setup.js
+++ b/spec/frontend/test_setup.js
@@ -1,4 +1,5 @@
import Vue from 'vue';
+import * as jqueryMatchers from 'custom-jquery-matchers';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
@@ -44,3 +45,10 @@ Object.assign(global, {
preloadFixtures() {},
setFixtures: setHTMLFixture,
});
+
+// custom-jquery-matchers was written for an old Jest version, we need to make it compatible
+Object.entries(jqueryMatchers).forEach(([matcherName, matcherFactory]) => {
+ expect.extend({
+ [matcherName]: matcherFactory().compare,
+ });
+});