diff options
author | Mike Greiling <mike@pixelcog.com> | 2019-03-13 19:20:19 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-03-13 19:20:19 +0000 |
commit | 9cdb7621fa98ed68c8b0f3ac9f3209d16f7f1743 (patch) | |
tree | 426402e81918a49b4461fad5bc64fae1bf51f1cc | |
parent | dd6af1262cbe8b1271a52b0a4654807397123bd0 (diff) | |
parent | 4a5eedb1757aed21e815323356ef67ae614526d2 (diff) | |
download | gitlab-ce-9cdb7621fa98ed68c8b0f3ac9f3209d16f7f1743.tar.gz |
Merge branch 'winh-ignore-karma-404' into 'master'
Hide 404 errors in Karma locally
See merge request gitlab-org/gitlab-ce!26073
-rw-r--r-- | config/karma.config.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/config/karma.config.js b/config/karma.config.js index 23eae40dceb..1d6ff797a29 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -115,6 +115,15 @@ module.exports = function(config) { reporters: ['mocha'], webpack: webpackConfig, webpackMiddleware: { stats: 'errors-only' }, + plugins: [ + 'karma-chrome-launcher', + 'karma-coverage-istanbul-reporter', + 'karma-jasmine', + 'karma-junit-reporter', + 'karma-mocha-reporter', + 'karma-sourcemap-loader', + 'karma-webpack', + ], }; if (process.env.CI) { @@ -123,6 +132,19 @@ module.exports = function(config) { outputFile: 'junit_karma.xml', useBrowserName: false, }; + } else { + // ignore 404s in local environment because we are not fixing them and they bloat the log + function ignore404() { + return (request, response /* next */) => { + response.writeHead(404); + return response.end('NOT FOUND'); + }; + } + + karmaConfig.middleware = ['ignore-404']; + karmaConfig.plugins.push({ + 'middleware:ignore-404': ['factory', ignore404], + }); } if (process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage') { |