2017-01-07 00:19:42 +00:00
|
|
|
// enable test fixtures
|
2016-12-29 21:42:48 +00:00
|
|
|
require('jasmine-jquery');
|
2016-07-24 20:45:11 +00:00
|
|
|
|
2017-05-05 19:14:58 +00:00
|
|
|
jasmine.getFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
|
|
|
|
jasmine.getJSONFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
|
2017-01-07 00:19:42 +00:00
|
|
|
|
2017-01-06 21:44:03 +00:00
|
|
|
// include common libraries
|
2017-03-01 22:01:33 +00:00
|
|
|
require('~/commons/index.js');
|
2017-01-06 21:44:03 +00:00
|
|
|
window.$ = window.jQuery = require('jquery');
|
|
|
|
window._ = require('underscore');
|
|
|
|
|
|
|
|
// stub expected globals
|
2016-11-19 21:59:32 +00:00
|
|
|
window.gl = window.gl || {};
|
2016-12-31 00:14:33 +00:00
|
|
|
window.gl.TEST_HOST = 'http://test.host';
|
|
|
|
window.gon = window.gon || {};
|
2017-01-07 00:19:42 +00:00
|
|
|
|
|
|
|
// render all of our tests
|
|
|
|
const testsContext = require.context('.', true, /_spec$/);
|
|
|
|
testsContext.keys().forEach(function (path) {
|
|
|
|
try {
|
|
|
|
testsContext(path);
|
|
|
|
} catch (err) {
|
2017-02-07 17:41:29 +00:00
|
|
|
console.error('[ERROR] Unable to load spec: ', path);
|
|
|
|
describe('Test bundle', function () {
|
|
|
|
it(`includes '${path}'`, function () {
|
|
|
|
expect(err).toBeNull();
|
|
|
|
});
|
|
|
|
});
|
2017-01-07 00:19:42 +00:00
|
|
|
}
|
|
|
|
});
|
2017-02-10 23:45:54 +00:00
|
|
|
|
2017-03-20 22:29:45 +00:00
|
|
|
// if we're generating coverage reports, make sure to include all files so
|
|
|
|
// that we can catch files with 0% coverage
|
|
|
|
// see: https://github.com/deepsweet/istanbul-instrumenter-loader/issues/15
|
|
|
|
if (process.env.BABEL_ENV === 'coverage') {
|
|
|
|
// exempt these files from the coverage report
|
2017-02-10 23:45:54 +00:00
|
|
|
const troubleMakers = [
|
2017-03-08 00:04:20 +00:00
|
|
|
'./blob_edit/blob_bundle.js',
|
|
|
|
'./boards/boards_bundle.js',
|
2017-03-24 22:08:46 +00:00
|
|
|
'./cycle_analytics/cycle_analytics_bundle.js',
|
2017-02-10 23:45:54 +00:00
|
|
|
'./cycle_analytics/components/stage_plan_component.js',
|
|
|
|
'./cycle_analytics/components/stage_staging_component.js',
|
|
|
|
'./cycle_analytics/components/stage_test_component.js',
|
2017-03-24 22:08:46 +00:00
|
|
|
'./commit/pipelines/pipelines_bundle.js',
|
|
|
|
'./diff_notes/diff_notes_bundle.js',
|
2017-02-10 23:45:54 +00:00
|
|
|
'./diff_notes/components/jump_to_discussion.js',
|
|
|
|
'./diff_notes/components/resolve_count.js',
|
2017-03-24 22:08:46 +00:00
|
|
|
'./dispatcher.js',
|
|
|
|
'./environments/environments_bundle.js',
|
|
|
|
'./filtered_search/filtered_search_bundle.js',
|
|
|
|
'./graphs/graphs_bundle.js',
|
|
|
|
'./issuable/issuable_bundle.js',
|
|
|
|
'./issuable/time_tracking/time_tracking_bundle.js',
|
|
|
|
'./main.js',
|
|
|
|
'./merge_conflicts/merge_conflicts_bundle.js',
|
2017-02-10 23:45:54 +00:00
|
|
|
'./merge_conflicts/components/inline_conflict_lines.js',
|
|
|
|
'./merge_conflicts/components/parallel_conflict_lines.js',
|
2017-03-24 22:08:46 +00:00
|
|
|
'./monitoring/monitoring_bundle.js',
|
|
|
|
'./network/network_bundle.js',
|
2017-02-10 23:45:54 +00:00
|
|
|
'./network/branch_graph.js',
|
2017-03-24 22:08:46 +00:00
|
|
|
'./profile/profile_bundle.js',
|
|
|
|
'./protected_branches/protected_branches_bundle.js',
|
|
|
|
'./snippet/snippet_bundle.js',
|
|
|
|
'./terminal/terminal_bundle.js',
|
|
|
|
'./users/users_bundle.js',
|
2017-04-06 01:13:06 +00:00
|
|
|
'./issue_show/index.js',
|
2017-02-10 23:45:54 +00:00
|
|
|
];
|
|
|
|
|
2017-03-20 22:29:45 +00:00
|
|
|
describe('Uncovered files', function () {
|
|
|
|
const sourceFiles = require.context('~', true, /\.js$/);
|
|
|
|
sourceFiles.keys().forEach(function (path) {
|
|
|
|
// ignore if there is a matching spec file
|
|
|
|
if (testsContext.keys().indexOf(`${path.replace(/\.js$/, '')}_spec`) > -1) {
|
|
|
|
return;
|
|
|
|
}
|
2017-02-10 23:45:54 +00:00
|
|
|
|
2017-03-20 22:29:45 +00:00
|
|
|
it(`includes '${path}'`, function () {
|
|
|
|
try {
|
|
|
|
sourceFiles(path);
|
|
|
|
} catch (err) {
|
|
|
|
if (troubleMakers.indexOf(path) === -1) {
|
|
|
|
expect(err).toBeNull();
|
|
|
|
}
|
2017-02-10 23:45:54 +00:00
|
|
|
}
|
2017-03-20 22:29:45 +00:00
|
|
|
});
|
2017-02-10 23:45:54 +00:00
|
|
|
});
|
|
|
|
});
|
2017-03-20 22:29:45 +00:00
|
|
|
}
|