summaryrefslogtreecommitdiff
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
parentcff134b87c6bbd497e41e221a375ce9125bc5704 (diff)
downloadgitlab-ce-winh-jest-jquery-matchers.tar.gz
Add jQuery matchers to Jestwinh-jest-jquery-matchers
-rw-r--r--package.json1
-rw-r--r--spec/frontend/test_setup.js8
-rw-r--r--yarn.lock5
3 files changed, 14 insertions, 0 deletions
diff --git a/package.json b/package.json
index 90fcfe01438..f80f9b3690b 100644
--- a/package.json
+++ b/package.json
@@ -144,6 +144,7 @@
"babel-plugin-rewire": "^1.2.0",
"chalk": "^2.4.1",
"commander": "^2.18.0",
+ "custom-jquery-matchers": "^2.1.0",
"docdash": "^1.0.2",
"eslint": "~5.9.0",
"eslint-import-resolver-jest": "^2.1.1",
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,
+ });
+});
diff --git a/yarn.lock b/yarn.lock
index 29f535830ea..846e29862f1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2742,6 +2742,11 @@ custom-event@~1.0.0:
resolved "https://registry.yarnpkg.com/custom-event/-/custom-event-1.0.1.tgz#5d02a46850adf1b4a317946a3928fccb5bfd0425"
integrity sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=
+custom-jquery-matchers@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/custom-jquery-matchers/-/custom-jquery-matchers-2.1.0.tgz#e5988fa9715c416b0986b372563f872d9e91e024"
+ integrity sha512-f2vQrncnwqbeDne9ag/BRjrmG9BxIEKnZ9Z8TyG5l9B8wwyINWd7LvuHDlTkMPqLTd3ghcvqFoTsxjhOP371JQ==
+
cyclist@~0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"