summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-04-25 11:49:06 +0200
committerWinnie Hellmann <winnie@gitlab.com>2019-05-02 23:11:18 +0200
commitfbac16b2de4b715a85dfd2b79768079d12229bc1 (patch)
tree5cd08edf46399c869b30d3cf2c5c78022726427c
parent6e3165f0b4bcbb12d88b653df7f6b66349b7b375 (diff)
downloadgitlab-ce-winh-separate-frontend-fixtures.tar.gz
Load EE fixtures from ee/ directory in Jestwinh-separate-frontend-fixtures
(cherry picked from commit 2917a28a885922a03f2026ddbb2680bc2b6e5d50)
-rw-r--r--spec/frontend/environment.js7
-rw-r--r--spec/frontend/helpers/fixtures.js4
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.