How to use the @microsoft/sp-build-web/lib/karma/karma.config function in @microsoft/sp-build-web

To help you get started, we’ve selected a few @microsoft/sp-build-web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SharePoint / sp-dev-build-extensions / samples / azure-devops-ci-cd-spfx / config / karma.config.js View on Github external
module.exports = function (config) {
  existingKarmaConfig(config);
  config.reporters.push('junit');

  config.set({
    basePath: './..',
  });

  config.junitReporter = {
    outputDir: 'temp/', // results will be saved as $outputDir/$browserName.xml
    outputFile: 'test-results.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
    suite: 'karma', // suite will become the package name attribute in xml testsuite element
    useBrowserName: true, // add browser name to report and classes names
  };
  var coberturaSubDir = 'cobertura';
  var coverageSubDir = 'lcov';
  var coberturaFileName = 'cobertura.xml';
  config.coverageReporter.reporters.push({type: 'cobertura', subdir: './' + coberturaSubDir, file: coberturaFileName});
github SharePoint / sp-dev-fx-controls-react / config / karma.config.js View on Github external
module.exports = function (config) {
  existingKarmaConfig(config);
  // Add the HTML reporter
  config.reporters.push('html');
  config.htmlReporter = {
    outputDir: path.join(gulp_core_build.getConfig().tempFolder, 'karma-html-report'),
    templatePath: null,
    focusOnFailures: true,
    namedFiles: true,
    pageTitle: 'sp-dev-fx-controls-react unit-tests report',
    urlFriendlyName: false,
    reportName: 'sp-dev-fx-controls-react-report',
  };
  config.plugins.push(htmlReporter);

  // Add the remap-coverage - code coverage for the original files
  config.reporters.push('remap-coverage');
  config.coverageReporter = {