Skip to content

Commit a01d590

Browse files
committed
Karma config updates
1 parent 406e73f commit a01d590

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

config/karma.config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
"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 remapCoverageReporter = require('karma-remap-coverage');
6-
var path = require('path');
2+
const existingKarmaConfig = require('@microsoft/sp-build-web/lib/karma/karma.config');
3+
const gulp_core_build = require("@microsoft/gulp-core-build");
4+
const htmlReporter = require('karma-html-reporter');
5+
const remapCoverageReporter = require('karma-remap-coverage');
6+
const path = require('path');
77

88
module.exports = function (config) {
99
existingKarmaConfig(config);
1010
// Add the HTML reporter
1111
config.reporters.push('html');
1212
config.htmlReporter = {
13-
outputDir: path.join(gulp_core_build.getConfig().tempFolder, 'karma-html-report'), // where to put the reports
14-
templatePath: null, // set if you moved jasmine_template.html
15-
focusOnFailures: true, // reports show failures on start
16-
namedFiles: true, // name files instead of creating sub-directories
17-
pageTitle: 'sp-dev-fx-controls-react unit-tests report', // page title for reports; browser info by default
18-
urlFriendlyName: false, // simply replaces spaces with _ for files/dirs
19-
reportName: 'sp-dev-fx-controls-react-report', // report summary filename; browser info by default
13+
outputDir: path.join(gulp_core_build.getConfig().tempFolder, 'karma-html-report'),
14+
templatePath: null,
15+
focusOnFailures: true,
16+
namedFiles: true,
17+
pageTitle: 'sp-dev-fx-controls-react unit-tests report',
18+
urlFriendlyName: false,
19+
reportName: 'sp-dev-fx-controls-react-report',
2020
};
2121
config.plugins.push(htmlReporter);
2222

gulpfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
22

33
const gulp = require('gulp');
4-
const _ = require('lodash');
54
const build = require('@microsoft/sp-build-web');
65

76
build.initialize(gulp);
87

9-
var buildConfig = build.getConfig();
10-
var karmaTask = _.find(buildConfig.uniqueTasks, ['name', 'karma']);
11-
karmaTask.taskConfig.configPath = './config/karma.config.js';
8+
const karmaTask = build.karma;
9+
if (karmaTask) {
10+
karmaTask.taskConfig.configPath = './config/karma.config.js';
11+
}

0 commit comments

Comments
 (0)