Commit 40c0337d authored by Phil Hughes's avatar Phil Hughes

Merge branch '3871-move-ee-specific-javascript-tests-to-ee-part-1' into 'master'

Part 1 of "Move EE JavaScript tests to their own respective directory"

See merge request gitlab-org/gitlab-ee!6184
parents d0a81caf 9145daf6
......@@ -103,6 +103,7 @@ module.exports = function(config) {
],
preprocessors: {
'spec/javascripts/**/*.js': ['webpack', 'sourcemap'],
'ee/spec/javascripts/**/*.js': ['webpack', 'sourcemap'],
},
reporters: [progressReporter],
webpack: webpackConfig,
......
......@@ -107,6 +107,7 @@ module.exports = {
ee_empty_states: path.join(ROOT_PATH, 'ee/app/views/shared/empty_states'),
ee_icons: path.join(ROOT_PATH, 'ee/app/views/shared/icons'),
ee_images: path.join(ROOT_PATH, 'ee/app/assets/images'),
ee_spec: path.join(ROOT_PATH, 'ee/spec/javascripts'),
},
},
......
<script>
import ReportSection from 'ee/vue_shared/security_reports/components/report_section.vue';
import GroupedSecurityReportsApp from 'ee/vue_shared/security_reports/grouped_security_reports_app.vue';
import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
import { n__, s__, __, sprintf } from '~/locale';
import CEWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue';
import WidgetApprovals from './components/approvals/mr_widget_approvals.vue';
import GeoSecondaryNode from './components/states/mr_widget_secondary_geo_node.vue';
import ReportSection from '../vue_shared/security_reports/components/report_section.vue';
import GroupedSecurityReportsApp from '../vue_shared/security_reports/grouped_security_reports_app.vue';
import reportsMixin from '../vue_shared/security_reports/mixins/reports_mixin';
export default {
components: {
......
import CEMergeRequestStore from '~/vue_merge_request_widget/stores/mr_widget_store';
import { filterByKey } from '../../vue_shared/security_reports/store/utils';
import { filterByKey } from 'ee/vue_shared/security_reports/store/utils';
export default class MergeRequestStore extends CEMergeRequestStore {
constructor(data) {
......
---
env:
jasmine: true
extends: plugin:jasmine/recommended
globals:
appendLoadFixtures: false
appendLoadStyleFixtures: false
appendSetFixtures: false
appendSetStyleFixtures: false
getJSONFixture: false
loadFixtures: false
loadJSONFixtures: false
loadStyleFixtures: false
preloadFixtures: false
preloadStyleFixtures: false
readFixtures: false
sandbox: false
setFixtures: false
setStyleFixtures: false
spyOnDependency: false
spyOnEvent: false
ClassSpecHelper: false
plugins:
- jasmine
rules:
func-names: off
jasmine/no-suite-dupes:
- warn
- branch
jasmine/no-spec-dupes:
- warn
- branch
no-console: off
prefer-arrow-callback: off
import/no-extraneous-dependencies:
- error
- devDependencies:
- ee/spec/**/*.js
......@@ -85,19 +85,25 @@ beforeEach(() => {
const axiosDefaultAdapter = getDefaultAdapter();
// render all of our tests
const testsContext = require.context('.', true, /_spec$/);
testsContext.keys().forEach(function(path) {
try {
testsContext(path);
} catch (err) {
console.log(err);
console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path);
describe('Test bundle', function() {
it(`includes '${path}'`, function() {
expect(err).toBeNull();
const testContexts = [
require.context('spec', true, /_spec$/),
require.context('ee_spec', true, /_spec$/),
];
testContexts.forEach(context => {
context.keys().forEach(path => {
try {
context(path);
} catch (err) {
console.log(err);
console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path);
describe('Test bundle', function() {
it(`includes '${path}'`, function() {
expect(err).toBeNull();
});
});
});
}
}
});
});
describe('test errors', () => {
......@@ -166,24 +172,31 @@ if (process.env.BABEL_ENV === 'coverage') {
];
describe('Uncovered files', function() {
const sourceFiles = require.context('~', true, /\.js$/);
const sourceFilesContexts = [
require.context('~', true, /\.js$/),
require.context('ee', true, /\.js$/),
];
const allTestFiles = testContexts.reduce((accumulator, context) =>
accumulator.concat(context.keys()), []);
$.holdReady(true);
sourceFiles.keys().forEach(function(path) {
// ignore if there is a matching spec file
if (testsContext.keys().indexOf(`${path.replace(/\.js$/, '')}_spec`) > -1) {
return;
}
it(`includes '${path}'`, function() {
try {
sourceFiles(path);
} catch (err) {
if (troubleMakers.indexOf(path) === -1) {
expect(err).toBeNull();
}
sourceFilesContexts.forEach(context => {
context.keys().forEach(path => {
// ignore if there is a matching spec file
if (allTestFiles.indexOf(`${path.replace(/\.js$/, '')}_spec`) > -1) {
return;
}
it(`includes '${path}'`, function() {
try {
context(path);
} catch (err) {
if (troubleMakers.indexOf(path) === -1) {
expect(err).toBeNull();
}
}
});
});
});
});
......
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