summaryrefslogtreecommitdiff
path: root/spec/frontend/test_setup.js
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-03-28 14:46:49 +0100
committerWinnie Hellmann <winnie@gitlab.com>2019-04-01 12:38:11 +0200
commit79a92c84d2b1e9de4ef3bebbd0ade57d34208f4b (patch)
tree08b3950f8f166121fcaeacc9f47a0cecc5825f49 /spec/frontend/test_setup.js
parentcff134b87c6bbd497e41e221a375ce9125bc5704 (diff)
downloadgitlab-ce-winh-jest-jquery-matchers.tar.gz
Add jQuery matchers to Jestwinh-jest-jquery-matchers
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,
+ });
+});