Commit fbac16b2 authored by Winnie Hellmann's avatar Winnie Hellmann

Load EE fixtures from ee/ directory in Jest

(cherry picked from commit 2917a28a885922a03f2026ddbb2680bc2b6e5d50)
parent 6e3165f0
......@@ -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() {
......
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment