Commit 099e404a authored by Mike Greiling's avatar Mike Greiling

Merge branch 'winh-karma-junit' into 'master'

Generate JUnit report for Karma tests

See merge request gitlab-org/gitlab-ce!21473
parents 9b076493 01b66964
...@@ -78,3 +78,4 @@ eslint-report.html ...@@ -78,3 +78,4 @@ eslint-report.html
/.gitlab_pages_secret /.gitlab_pages_secret
package-lock.json package-lock.json
/junit_rspec.xml /junit_rspec.xml
/junit_karma.xml
...@@ -743,6 +743,8 @@ karma: ...@@ -743,6 +743,8 @@ karma:
paths: paths:
- chrome_debug.log - chrome_debug.log
- coverage-javascript/ - coverage-javascript/
reports:
junit: junit_karma.xml
code_quality: code_quality:
<<: *dedicated-no-docs-no-db-pull-cache-job <<: *dedicated-no-docs-no-db-pull-cache-job
......
...@@ -80,11 +80,12 @@ if (specFilters.length) { ...@@ -80,11 +80,12 @@ if (specFilters.length) {
module.exports = function(config) { module.exports = function(config) {
process.env.TZ = 'Etc/UTC'; process.env.TZ = 'Etc/UTC';
const progressReporter = process.env.CI ? 'mocha' : 'progress';
const karmaConfig = { const karmaConfig = {
basePath: ROOT_PATH, basePath: ROOT_PATH,
browsers: ['ChromeHeadlessCustom'], browsers: ['ChromeHeadlessCustom'],
client: {
isCI: !!process.env.CI
},
customLaunchers: { customLaunchers: {
ChromeHeadlessCustom: { ChromeHeadlessCustom: {
base: 'ChromeHeadless', base: 'ChromeHeadless',
...@@ -104,11 +105,19 @@ module.exports = function(config) { ...@@ -104,11 +105,19 @@ module.exports = function(config) {
preprocessors: { preprocessors: {
'spec/javascripts/**/*.js': ['webpack', 'sourcemap'], 'spec/javascripts/**/*.js': ['webpack', 'sourcemap'],
}, },
reporters: [progressReporter], reporters: ['progress'],
webpack: webpackConfig, webpack: webpackConfig,
webpackMiddleware: { stats: 'errors-only' }, webpackMiddleware: { stats: 'errors-only' },
}; };
if (process.env.CI) {
karmaConfig.reporters = ['mocha', 'junit'];
karmaConfig.junitReporter = {
outputFile: 'junit_karma.xml',
useBrowserName: false,
};
}
if (process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage') { if (process.env.BABEL_ENV === 'coverage' || process.env.NODE_ENV === 'coverage') {
karmaConfig.reporters.push('coverage-istanbul'); karmaConfig.reporters.push('coverage-istanbul');
karmaConfig.coverageIstanbulReporter = { karmaConfig.coverageIstanbulReporter = {
......
...@@ -146,7 +146,7 @@ describe('GfmAutoComplete', function () { ...@@ -146,7 +146,7 @@ describe('GfmAutoComplete', function () {
shouldNotBeFollowedBy.forEach((followedSymbol) => { shouldNotBeFollowedBy.forEach((followedSymbol) => {
const seq = atSign + followedSymbol; const seq = atSign + followedSymbol;
it(`should not match "${seq}"`, () => { it(`should not match ${JSON.stringify(seq)}`, () => {
expect(defaultMatcher(atwhoInstance, atSign, seq)).toBe(null); expect(defaultMatcher(atwhoInstance, atSign, seq)).toBe(null);
}); });
}); });
......
/* eslint-disable /* eslint-disable
jasmine/no-global-setup, jasmine/no-unsafe-spy, no-underscore-dangle, no-console jasmine/no-global-setup, jasmine/no-unsafe-spy, no-underscore-dangle, no-console
*/ */
/* global __karma__ */
import $ from 'jquery'; import $ from 'jquery';
import 'vendor/jasmine-jquery'; import 'vendor/jasmine-jquery';
...@@ -41,8 +42,8 @@ jasmine.getJSONFixtures().fixturesPath = FIXTURES_PATH; ...@@ -41,8 +42,8 @@ jasmine.getJSONFixtures().fixturesPath = FIXTURES_PATH;
beforeAll(() => { beforeAll(() => {
jasmine.addMatchers( jasmine.addMatchers(
jasmineDiff(jasmine, { jasmineDiff(jasmine, {
colors: true, colors: !__karma__.config.isCi,
inline: true, inline: !__karma__.config.isCi,
}), }),
); );
jasmine.addMatchers(customMatchers); jasmine.addMatchers(customMatchers);
......
...@@ -4220,6 +4220,13 @@ karma-jasmine@^1.1.2: ...@@ -4220,6 +4220,13 @@ karma-jasmine@^1.1.2:
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-1.1.2.tgz#394f2b25ffb4a644b9ada6f22d443e2fd08886c3" resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-1.1.2.tgz#394f2b25ffb4a644b9ada6f22d443e2fd08886c3"
karma-junit-reporter@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz#4f9c40cedfb1a395f8aef876abf96189917c6396"
dependencies:
path-is-absolute "^1.0.0"
xmlbuilder "8.2.2"
karma-mocha-reporter@^2.2.5: karma-mocha-reporter@^2.2.5:
version "2.2.5" version "2.2.5"
resolved "https://registry.yarnpkg.com/karma-mocha-reporter/-/karma-mocha-reporter-2.2.5.tgz#15120095e8ed819186e47a0b012f3cd741895560" resolved "https://registry.yarnpkg.com/karma-mocha-reporter/-/karma-mocha-reporter-2.2.5.tgz#15120095e8ed819186e47a0b012f3cd741895560"
...@@ -7139,6 +7146,10 @@ xdg-basedir@^3.0.0: ...@@ -7139,6 +7146,10 @@ xdg-basedir@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"
xmlbuilder@8.2.2:
version "8.2.2"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-8.2.2.tgz#69248673410b4ba42e1a6136551d2922335aa773"
xmlhttprequest-ssl@~1.5.4: xmlhttprequest-ssl@~1.5.4:
version "1.5.5" version "1.5.5"
resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e" resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e"
......
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