diff options
author | Phil Hughes <me@iamphill.com> | 2019-05-07 10:45:42 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-05-07 10:45:42 +0300 |
commit | 06b06736eb314bf4144ae50400fbe9d8f8f3cae7 (patch) | |
tree | e7db2052049b3cd9ed9a8c7d50616383ce58c5ef /spec/frontend | |
parent | 2cbfd5c58cfcfe43dbaee3e6734bdf5fff9105b9 (diff) | |
parent | fbac16b2de4b715a85dfd2b79768079d12229bc1 (diff) |
Merge branch 'winh-separate-frontend-fixtures' into 'master'
Generate EE-specific JavaScript fixtures into ee/ directory (CE-backport)
See merge request gitlab-org/gitlab-ce!28032
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/environment.js | 7 | ||||
-rw-r--r-- | spec/frontend/helpers/fixtures.js | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/spec/frontend/environment.js b/spec/frontend/environment.js index 34df8019a2e..9612162ad0c 100644 --- a/spec/frontend/environment.js +++ b/spec/frontend/environment.js @@ -24,8 +24,9 @@ class CustomEnvironment extends JSDOMEnvironment { }); const { testEnvironmentOptions } = config; + const { IS_EE } = testEnvironmentOptions; this.global.gon = { - ee: testEnvironmentOptions.IS_EE, + ee: IS_EE, }; this.rejectedPromises = []; @@ -33,6 +34,10 @@ class CustomEnvironment extends JSDOMEnvironment { this.global.promiseRejectionHandler = error => { this.rejectedPromises.push(error); }; + + this.global.fixturesBasePath = `${process.cwd()}/${ + IS_EE ? 'ee/' : '' + }spec/javascripts/fixtures`; } async teardown() { diff --git a/spec/frontend/helpers/fixtures.js b/spec/frontend/helpers/fixtures.js index f0351aa31c6..b77bcd6266e 100644 --- a/spec/frontend/helpers/fixtures.js +++ b/spec/frontend/helpers/fixtures.js @@ -3,10 +3,8 @@ import path from 'path'; import { ErrorWithStack } from 'jest-util'; -const fixturesBasePath = path.join(process.cwd(), 'spec', 'javascripts', 'fixtures'); - export function getFixture(relativePath) { - const absolutePath = path.join(fixturesBasePath, relativePath); + const absolutePath = path.join(global.fixturesBasePath, relativePath); if (!fs.existsSync(absolutePath)) { throw new ErrorWithStack( `Fixture file ${relativePath} does not exist. |