diff options
author | Mike Greiling <mike@pixelcog.com> | 2019-07-18 13:46:46 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-07-19 02:00:46 -0500 |
commit | afd39a8df0a78b3648656f8d899f605d51600b23 (patch) | |
tree | eb5e9357a0a08040a319500a2a65389d3acf9761 | |
parent | 5e0a288e7f26431e6f5795b174ed4cdf2d619bc9 (diff) | |
download | gitlab-ce-afd39a8df0a78b3648656f8d899f605d51600b23.tar.gz |
Prefer an absolute path over cwd()
-rw-r--r-- | spec/frontend/environment.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/spec/frontend/environment.js b/spec/frontend/environment.js index a8c8688441d..8fd39201d39 100644 --- a/spec/frontend/environment.js +++ b/spec/frontend/environment.js @@ -1,8 +1,11 @@ /* eslint-disable import/no-commonjs */ +const path = require('path'); const { ErrorWithStack } = require('jest-util'); const JSDOMEnvironment = require('jest-environment-jsdom'); +const ROOT_PATH = path.resolve(__dirname, '../..'); + class CustomEnvironment extends JSDOMEnvironment { constructor(config, context) { super(config, context); @@ -35,9 +38,7 @@ class CustomEnvironment extends JSDOMEnvironment { this.rejectedPromises.push(error); }; - this.global.fixturesBasePath = `${process.cwd()}/${ - IS_EE ? 'ee/' : '' - }spec/javascripts/fixtures`; + this.global.fixturesBasePath = `${ROOT_PATH}/${IS_EE ? 'ee/' : ''}spec/javascripts/fixtures`; // Not yet supported by JSDOM: https://github.com/jsdom/jsdom/issues/317 this.global.document.createRange = () => ({ |