Commit cea21d61 authored by Paul Slaughter's avatar Paul Slaughter

Add test_X aliases to webpack and jest

- test_fixtures
- test_helpers

This is used to run the mock server locally
parent 2cf0dd23
...@@ -119,6 +119,15 @@ if (IS_EE) { ...@@ -119,6 +119,15 @@ if (IS_EE) {
}); });
} }
if (!IS_PRODUCTION) {
const fixtureDir = IS_EE ? 'fixtures-ee' : 'fixtures';
Object.assign(alias, {
test_fixtures: path.join(ROOT_PATH, `tmp/tests/frontend/${fixtureDir}`),
test_helpers: path.join(ROOT_PATH, 'spec/frontend_integration/test_helpers'),
});
}
let dll; let dll;
if (VENDOR_DLL && !IS_PRODUCTION) { if (VENDOR_DLL && !IS_PRODUCTION) {
......
...@@ -40,6 +40,8 @@ module.exports = path => { ...@@ -40,6 +40,8 @@ module.exports = path => {
'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json', 'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json',
'^spec/test_constants$': '<rootDir>/spec/frontend/helpers/test_constants', '^spec/test_constants$': '<rootDir>/spec/frontend/helpers/test_constants',
'^jest/(.*)$': '<rootDir>/spec/frontend/$1', '^jest/(.*)$': '<rootDir>/spec/frontend/$1',
'test_helpers(/.*)$': '<rootDir>/spec/frontend_integration/test_helpers$1',
'test_fixtures(/.*)$': '<rootDir>/tmp/tests/frontend/fixtures$1',
}; };
const collectCoverageFrom = ['<rootDir>/app/assets/javascripts/**/*.{js,vue}']; const collectCoverageFrom = ['<rootDir>/app/assets/javascripts/**/*.{js,vue}'];
...@@ -51,6 +53,7 @@ module.exports = path => { ...@@ -51,6 +53,7 @@ module.exports = path => {
'^ee_component(/.*)$': rootDirEE, '^ee_component(/.*)$': rootDirEE,
'^ee_else_ce(/.*)$': rootDirEE, '^ee_else_ce(/.*)$': rootDirEE,
'^ee_jest/(.*)$': '<rootDir>/ee/spec/frontend/$1', '^ee_jest/(.*)$': '<rootDir>/ee/spec/frontend/$1',
'test_fixtures(/.*)$': '<rootDir>/tmp/tests/frontend/fixtures-ee$1',
}); });
collectCoverageFrom.push(rootDirEE.replace('$1', '/**/*.{js,vue}')); collectCoverageFrom.push(rootDirEE.replace('$1', '/**/*.{js,vue}'));
...@@ -75,7 +78,7 @@ module.exports = path => { ...@@ -75,7 +78,7 @@ module.exports = path => {
cacheDirectory: '<rootDir>/tmp/cache/jest', cacheDirectory: '<rootDir>/tmp/cache/jest',
modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'], modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'],
reporters, reporters,
setupFilesAfterEnv: ['<rootDir>/spec/frontend/test_setup.js', 'jest-canvas-mock'], setupFilesAfterEnv: [`<rootDir>/${path}/test_setup.js`, 'jest-canvas-mock'],
restoreMocks: true, restoreMocks: true,
transform: { transform: {
'^.+\\.(gql|graphql)$': 'jest-transform-graphql', '^.+\\.(gql|graphql)$': 'jest-transform-graphql',
......
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