|
| 1 | +"use strict"; |
| 2 | +var existingKarmaConfig = require('@microsoft/sp-build-web/lib/karma/karma.config'); |
| 3 | +var gulp_core_build = require("@microsoft/gulp-core-build"); |
| 4 | +var htmlReporter = require('karma-html-reporter'); |
| 5 | +var path = require('path'); |
| 6 | + |
| 7 | +var remapCoverageReporter = require('karma-remap-coverage'); |
| 8 | + |
| 9 | +module.exports = function (config) { |
| 10 | + existingKarmaConfig(config); |
| 11 | + // Add the HTML reporter |
| 12 | + config.reporters.push('html'); |
| 13 | + config.htmlReporter = { |
| 14 | + outputDir: path.join(gulp_core_build.getConfig().tempFolder, 'karma-html-report'), // where to put the reports |
| 15 | + templatePath: null, // set if you moved jasmine_template.html |
| 16 | + focusOnFailures: true, // reports show failures on start |
| 17 | + namedFiles: true, // name files instead of creating sub-directories |
| 18 | + pageTitle: 'sp-dev-fx-controls-react unit-tests report', // page title for reports; browser info by default |
| 19 | + urlFriendlyName: false, // simply replaces spaces with _ for files/dirs |
| 20 | + reportName: 'sp-dev-fx-controls-react-report', // report summary filename; browser info by default |
| 21 | + }; |
| 22 | + config.plugins.push(htmlReporter); |
| 23 | + |
| 24 | + // Add the remap-coverage - code coverage for the original files |
| 25 | + config.reporters.push('remap-coverage'); |
| 26 | + config.coverageReporter = { |
| 27 | + type: 'in-memory' |
| 28 | + } |
| 29 | + config.remapCoverageReporter = { |
| 30 | + 'text-summary': null, |
| 31 | + html: path.join(gulp_core_build.getConfig().tempFolder, 'coverage/html'), |
| 32 | + cobertura: path.join(gulp_core_build.getConfig().tempFolder, 'coverage/cobertura.xml') |
| 33 | + }; |
| 34 | + config.plugins.push(remapCoverageReporter); |
| 35 | +}; |
0 commit comments