diff options
Diffstat (limited to 'spec/frontend/environment.js')
-rw-r--r-- | spec/frontend/environment.js | 7 |
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() { |