summaryrefslogtreecommitdiff
path: root/spec/frontend/environment.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/frontend/environment.js
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
downloadgitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/frontend/environment.js')
-rw-r--r--spec/frontend/environment.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/frontend/environment.js b/spec/frontend/environment.js
index 08da34aa27a..c9d77a34595 100644
--- a/spec/frontend/environment.js
+++ b/spec/frontend/environment.js
@@ -3,12 +3,14 @@
const path = require('path');
const { ErrorWithStack } = require('jest-util');
const JSDOMEnvironment = require('jest-environment-jsdom-sixteen');
+const { TEST_HOST } = require('./helpers/test_constants');
const ROOT_PATH = path.resolve(__dirname, '../..');
class CustomEnvironment extends JSDOMEnvironment {
constructor(config, context) {
- super(config, context);
+ // Setup testURL so that window.location is setup properly
+ super({ ...config, testURL: TEST_HOST }, context);
Object.assign(context.console, {
error(...args) {
@@ -57,6 +59,9 @@ class CustomEnvironment extends JSDOMEnvironment {
ownerDocument: this.global.document,
},
});
+
+ // Expose the jsdom (created in super class) to the global so that we can call reconfigure({ url: '' }) to properly set `window.location`
+ this.global.dom = this.dom;
}
async teardown() {