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

Generate JUnit report for Karma tests

See merge request gitlab-org/gitlab-ce!21473
This commit is contained in:
Mike Greiling 2018-09-11 21:03:05 +00:00
commit 099e404a2b
7 changed files with 31 additions and 6 deletions

1
.gitignore vendored
View file

@ -78,3 +78,4 @@ eslint-report.html
/.gitlab_pages_secret
package-lock.json
/junit_rspec.xml
/junit_karma.xml

View file

@ -743,6 +743,8 @@ karma:
paths:
- chrome_debug.log
- coverage-javascript/
reports:
junit: junit_karma.xml
code_quality:
<<: *dedicated-no-docs-no-db-pull-cache-job

View file

@ -80,11 +80,12 @@ if (specFilters.length) {
module.exports = function(config) {
process.env.TZ = 'Etc/UTC';
const progressReporter = process.env.CI ? 'mocha' : 'progress';
const karmaConfig = {
basePath: ROOT_PATH,
browsers: ['ChromeHeadlessCustom'],
client: {
isCI: !!process.env.CI
},
customLaunchers: {
ChromeHeadlessCustom: {
base: 'ChromeHeadless',
@ -104,11 +105,19 @@ module.exports = function(config) {
preprocessors: {
'spec/javascripts/**/*.js': ['webpack', 'sourcemap'],
},
reporters: [progressReporter],
reporters: ['progress'],
webpack: webpackConfig,
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') {
karmaConfig.reporters.push('coverage-istanbul');
karmaConfig.coverageIstanbulReporter = {

View file

@ -137,6 +137,7 @@
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "^1.1.2",
"karma-junit-reporter": "^1.2.0",
"karma-mocha-reporter": "^2.2.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.0-beta.0",

View file

@ -146,7 +146,7 @@ describe('GfmAutoComplete', function () {
shouldNotBeFollowedBy.forEach((followedSymbol) => {
const seq = atSign + followedSymbol;
it(`should not match "${seq}"`, () => {
it(`should not match ${JSON.stringify(seq)}`, () => {
expect(defaultMatcher(atwhoInstance, atSign, seq)).toBe(null);
});
});

View file

@ -1,6 +1,7 @@
/* eslint-disable
jasmine/no-global-setup, jasmine/no-unsafe-spy, no-underscore-dangle, no-console
*/
/* global __karma__ */
import $ from 'jquery';
import 'vendor/jasmine-jquery';
@ -41,8 +42,8 @@ jasmine.getJSONFixtures().fixturesPath = FIXTURES_PATH;
beforeAll(() => {
jasmine.addMatchers(
jasmineDiff(jasmine, {
colors: true,
inline: true,
colors: !__karma__.config.isCi,
inline: !__karma__.config.isCi,
}),
);
jasmine.addMatchers(customMatchers);

View file

@ -4220,6 +4220,13 @@ karma-jasmine@^1.1.2:
version "1.1.2"
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:
version "2.2.5"
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:
version "3.0.0"
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:
version "1.5.5"
resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e"