How to use the karma.constants function in karma

To help you get started, we’ve selected a few karma 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 vanilla / vanilla / build / scripts / KarmaRunner.ts View on Github external
private async makeKarmaConfig(): Promise {
        return {
            preprocessors: this.preprocessors,
            files: this.files,
            // base path, that will be used to resolve files and exclude
            basePath: VANILLA_ROOT,
            frameworks: ["mocha", "chai"],
            reporters: ["mocha"],
            // reporter options
            mochaReporter: {
                output: "minimal",
                showDiff: true,
            },
            logLevel: Karma.constants.LOG_INFO,
            port: 9876, // karma web server port
            colors: true,
            mime: {
                "text/x-typescript": ["ts"],
            },
            browsers: [this.options.mode === BuildMode.TEST_DEBUG ? "ChromeDebug" : "ChromeHeadlessNoSandbox"],
            autoWatch: true,
            webpackMiddleware: {
                // webpack-dev-middleware configuration
                // i. e.
                stats: "errors-only",
            },
            webpack: await makeTestConfig(this.entryModel),
            singleRun: this.options.mode === BuildMode.TEST, // All other tests modes are in "watch mode".
            concurrency: Infinity,
            // you can define custom flags
github prebid / Prebid.js / karma.conf.maker.js View on Github external
// This configures Karma, describing how to run the tests and where to output code coverage reports.
//
// For more information, see http://karma-runner.github.io/1.0/config/configuration-file.html

var _ = require('lodash');
var webpackConf = require('./webpack.conf');
var path = require('path')
var karmaConstants = require('karma').constants;

function newWebpackConfig(codeCoverage) {
  // Make a clone here because we plan on mutating this object, and don't want parallel tasks to trample each other.
  var webpackConfig = _.cloneDeep(webpackConf);

  // remove optimize plugin for tests
  webpackConfig.plugins.pop()

  webpackConfig.devtool = 'inline-source-map';

  if (codeCoverage) {
    webpackConfig.module.rules.push({
      enforce: 'post',
      exclude: /(node_modules)|(test)|(integrationExamples)|(build)|polyfill.js|(src\/adapters\/analytics\/ga.js)/,
      use: {
        loader: 'istanbul-instrumenter-loader',
github prebid / prebid-universal-creative / karma.conf.maker.js View on Github external
var _ = require('lodash');
var webpackConf = require('./webpack.conf');
var karmaConstants = require('karma').constants;

function setBrowsers(karmaConf, browserstack, watchMode) {
  if (browserstack) {
    karmaConf.browserStack = {
      username: process.env.BROWSERSTACK_USERNAME,
      accessKey: process.env.BROWSERSTACK_ACCESS_KEY
    }
    karmaConf.customLaunchers = require('./browsers.json')
    karmaConf.browsers = Object.keys(karmaConf.customLaunchers);
  } else if (watchMode) {
    karmaConf.browsers = ['Chrome'];
  }
}

function setReporters(karmaConf, codeCoverage, browserstack) {
  // In browserstack, the default 'progress' reporter floods the logs.
github firebase / firebase-js-sdk / config / karma.base.js View on Github external
// test results reporter to use
  // possible values: 'dots', 'progress'
  // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  reporters: ['spec', 'coverage-istanbul' /*, 'saucelabs' */],

  // web server port
  port: 8089,

  // enable / disable colors in the output (reporters and logs)
  colors: true,

  // level of logging
  // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN
  // || config.LOG_INFO || config.LOG_DEBUG
  logLevel: karma.constants.LOG_INFO,

  // enable / disable watching file and executing tests whenever any file
  // changes
  autoWatch: false,

  customLaunchers: sauceLabsBrowsers,

  // start these browsers
  // available browser launchers:
  // https://npmjs.org/browse/keyword/karma-launcher
  browsers: ['ChromeHeadless'],

  webpack: webpackTestConfig,

  webpackMiddleware: { quiet: true, stats: { colors: true } },
github firebase / firebase-js-sdk / gulp / config.js View on Github external
// test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['spec'],
    
    // web server port
    port: 8080,
    
    
    // enable / disable colors in the output (reporters and logs)
    colors: true,
    
    
    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: karma.constants.LOG_INFO,
    
    
    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,
    
    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['ChromeHeadless'],
    
    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true,
    
    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: 1,
github Financial-Times / origami-build-tools / config / karma.config.browserstack.js View on Github external
const { getBaseKarmaConfig } = require('./karma.config');
const constants = require('karma').constants;

const customLaunchers = {
	// If browser_version is not set, uses latest stable version

	// Testing on minimum version for enhanced experience based on
	// https://docs.google.com/document/d/1AG4uZEFiWOkXfy0pdE3-3NCUP2No4MkoiZMLlJnO5lI/edit?ts=5d498574
	// Android 5
	bs_android5: {
		base: 'BrowserStack',
		device: 'Google Nexus 6',
		os: 'android',
		os_version: '5.0',
		real_mobile: true
	},

	// iOS 10
github davidwallacejackson / vue-cli-plugin-unit-karma / karma.conf.js View on Github external
const karmaConstants = require('karma').constants
const _ = require('lodash')
const merge = require('webpack-merge')

module.exports = ({optionsForThisPlugin, webpackConfig, watch, junit}) => {
  delete webpackConfig.entry
  webpackConfig = merge(webpackConfig, {
    devtool: optionsForThisPlugin.devtool || 'inline-source-map'
  })

  let karmaConfig = {
    files: optionsForThisPlugin.files,

    logLevel: karmaConstants.LOG_ERROR,

    reporters: ['mocha'],
github Nike-Inc / burnside / packages / burnside-cli / src / karmaRunner.js View on Github external
return new Promise(function getConf(resolve) {
      require(path.resolve(optionalPath))(Object.assign({}, karma.constants, {
        set: function setConfig(conf) {
          resolve(Object.assign({}, conf, opts));
        }
      }));
    });
  }
github instructure / instructure-ui / packages / ui-karma-config / lib / index.js View on Github external
* copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
const path = require('path')
const constants = require('karma').constants
const choma = require.resolve('choma')

const noLaunchers = process.argv.some((arg) => arg === '--no-launch')
const noHeadless = process.argv.some((arg) => arg === '--no-headless')
const randomizeTestOrder = process.argv.some((arg) => arg === '--randomize')

const baseWebpackConfig = require('@instructure/ui-webpack-config')

const DEBUG = process.env.DEBUG
const withCoverage = process.env.COVERAGE
const IS_SCOPED = process.env.UI_TEST_SCOPE_PATHS

const CHROME_FLAGS = [
  '--no-sandbox',
  '--disable-setuid-sandbox',
  '--use-mock-keychain',
github AnalyticalGraphicsInc / cesium / gulpfile.js View on Github external
files.push({pattern : 'Build/**', included : false});
    }

    var karma = new Karma.Server({
        configFile: karmaConfigFile,
        browsers: browsers,
        specReporter: {
            suppressErrorSummary: false,
            suppressFailed: false,
            suppressPassed: suppressPassed,
            suppressSkipped: true
        },
        detectBrowsers: {
            enabled: enableAllBrowsers
        },
        logLevel: verbose ? Karma.constants.LOG_INFO : Karma.constants.LOG_ERROR,
        files: files,
        client: {
            captureConsole: verbose,
            args: [includeCategory, excludeCategory, webglValidation, webglStub, release]
        }
    }, function(e) {
        return done(failTaskOnError ? e : undefined);
    });
    karma.start();
});