Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2019-03-29 19:59:16 +0300
committerClement Ho <clemmakesapps@gmail.com>2019-03-29 19:59:16 +0300
commitb4cc639f80407285e69bdb5cb2bda7dcd74c87e6 (patch)
tree62fbd5a578d165ebc0cd0d9d347e350d68073c78 /spec/frontend/test_setup.js
parent5f3556e274666266135cfeae0be380ee8e0d064a (diff)
parentb0e26ed5cedc9452b63616a58d52c404ff5b5c98 (diff)
Merge branch 'winh-jest-html-fixtures' into 'master'
Add helpers for HTML fixtures to Jest Closes #57998 See merge request gitlab-org/gitlab-ce!26739
Diffstat (limited to 'spec/frontend/test_setup.js')
-rw-r--r--spec/frontend/test_setup.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js
index f5b91d0e1c3..1e3c28e25eb 100644
--- a/spec/frontend/test_setup.js
+++ b/spec/frontend/test_setup.js
@@ -2,6 +2,7 @@ import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import axios from '~/lib/utils/axios_utils';
import { initializeTestTimeout } from './helpers/timeout';
+import { getJSONFixture, loadHTMLFixture, setHTMLFixture } from './helpers/fixtures';
// wait for pending setTimeout()s
afterEach(() => {
@@ -26,3 +27,20 @@ Vue.config.devtools = false;
Vue.config.productionTip = false;
Vue.use(Translate);
+
+// workaround for JSDOM not supporting innerText
+// see https://github.com/jsdom/jsdom/issues/1245
+Object.defineProperty(global.Element.prototype, 'innerText', {
+ get() {
+ return this.textContent;
+ },
+ configurable: true, // make it so that it doesn't blow chunks on re-running tests with things like --watch
+});
+
+// convenience wrapper for migration from Karma
+Object.assign(global, {
+ loadFixtures: loadHTMLFixture,
+ loadJSONFixtures: getJSONFixture,
+ preloadFixtures() {},
+ setFixtures: setHTMLFixture,
+});