summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2017-02-14 19:40:40 +0000
committerClement Ho <clemmakesapps@gmail.com>2017-02-14 19:40:40 +0000
commit9760fd7a95cb1dcdcee227817e41c924f5d39dc7 (patch)
tree80ffb9d8cc358680f4f6c486ad583c9e288cb270 /spec/javascripts
parentad5e772bddd7b417fa7a36629db02c69b1b9864d (diff)
parentbfb82f8a0d4d837a0472342c05de18c60037a2ea (diff)
downloadgitlab-ce-9760fd7a95cb1dcdcee227817e41c924f5d39dc7.tar.gz
Merge branch 'cover-my-karma' into 'master'
Reintroduce coverage report for JavaScript Closes #27826 and #20757 See merge request !9133
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/test_bundle.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index 030d2de090a..ca707d872a4 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -42,3 +42,38 @@ testsContext.keys().forEach(function (path) {
});
}
});
+
+// workaround: include all source files to find files with 0% coverage
+// see also https://github.com/deepsweet/istanbul-instrumenter-loader/issues/15
+describe('Uncovered files', function () {
+ // the following files throw errors because of undefined variables
+ const troubleMakers = [
+ './blob_edit/blob_edit_bundle.js',
+ './cycle_analytics/components/stage_plan_component.js',
+ './cycle_analytics/components/stage_staging_component.js',
+ './cycle_analytics/components/stage_test_component.js',
+ './diff_notes/components/jump_to_discussion.js',
+ './diff_notes/components/resolve_count.js',
+ './merge_conflicts/components/inline_conflict_lines.js',
+ './merge_conflicts/components/parallel_conflict_lines.js',
+ './network/branch_graph.js',
+ ];
+
+ const sourceFiles = require.context('~', true, /^\.\/(?!application\.js).*\.(js|es6)$/);
+ sourceFiles.keys().forEach(function (path) {
+ // ignore if there is a matching spec file
+ if (testsContext.keys().indexOf(`${path.replace(/\.js(\.es6)?$/, '')}_spec`) > -1) {
+ return;
+ }
+
+ it(`includes '${path}'`, function () {
+ try {
+ sourceFiles(path);
+ } catch (err) {
+ if (troubleMakers.indexOf(path) === -1) {
+ expect(err).toBeNull();
+ }
+ }
+ });
+ });
+});