How to use the karma.Server 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 dsebastien / modernWebDevBuild / gulp / tasks / test-unit.js View on Github external
gulp.task("test-unit-dev", "Execute all unit tests continuously (watches files)", (callback) =>{
    return new KarmaServer({
        configFile: karmaConfigFilePath, // necessary otherwise the file is not resolved correctly
        singleRun: false
    }, callback).start();
});
github SUI-Components / sui / packages / sui-test / bin / karma / index.js View on Github external
let resolve, reject

  // eslint-disable-next-line
  let promise = new Promise((res, rej) => {
    resolve = res
    reject = rej
  })

  let callback = code => {
    if (code === 0) return resolve()
    let err = Error(`Exit ${code}`)
    err.code = code
    reject(err)
  }

  let server = new Server(config, callback)

  server.completion = promise
  return server
}
github adammertel / Leaflet.RegularGridCluster / demo / lib / leaflet / Jakefile.js View on Github external
}

	 if (isArgv('--cov')) {
		 testConfig.preprocessors = {
			 'src/**/*.js': 'coverage'
		 };
		 testConfig.coverageReporter = {
			 type : 'html',
	 dir : 'coverage/'
		 };
		 testConfig.reporters = ['coverage'];
	 }

	 console.log('Running tests...');

	 var server = new karma.Server(testConfig, function(exitCode) {
		 if (!exitCode) {
			 console.log('\tTests ran successfully.\n');
			 complete();
		 } else {
			 process.exit(exitCode);
		 }
	 });
	 server.start();
});
github paypal / paypal-sdk-client / gulpfile.babel.js View on Github external
gulp.task('karma', ['lint'], function (done) {

  let server = new Server({
    configFile: __dirname + '/karma.conf.js',
    singleRun: !Boolean(argv['keep-browser-open']),
    client: {
      captureConsole: Boolean(argv['capture-console'])
    }
  });

  server.on('browser_error', function (browser, err) {
    console.log('Karma Run Failed: ' + err.message);
    throw err;
  });

  server.on('run_complete', function (browsers, results) {
    if (results.failed) {
      return done(new Error('Karma: Tests Failed'));
    }
github substantial / updeep / gulpfile.js View on Github external
gulp.task('watch', () => {
  gulp.start(['test:node'])
  gulp.watch(['lib/**/*.js', 'test/**/*.js'], ['test:node'])
  new KarmaServer({
    configFile: path.join(__dirname, 'karma.conf.js'),
  }).start()
})
github microsoft / PowerBI-JQuery / gulpfile.js View on Github external
gulp.task('test:js', 'Runs all tests', function(done) {
    new karma.Server({
        configFile: __dirname + '/karma.conf.js',
        singleRun: argv.debug ? false : true
    }, done).start();
});
github ejulianova / guides / gulpfile.js View on Github external
gulp.task('test', function (done) {
  new karmaServer({
    configFile: require('path').resolve('karma.conf.js'),
    singleRun: true
  }, done).start();
});
github jeff-collins / ment.io / gulpfile.js View on Github external
var karmaConfig = {
        configFile: __dirname + '/karma.conf.js',
        action: params.isWatch ? 'watch' : 'run',
        singleRun: true
    };

    if (params.coverageReporter) {
        karmaConfig.coverageReporter = params.coverageReporter;
    }

    if (params.reporters) {
        karmaConfig.reporters = params.reporters;
    }

    new karma.Server(karmaConfig).start();
}
github aldryn / aldryn-events / gulpfile.js View on Github external
gulp.task('tests:unit', function (done) {
    var server = new KarmaServer({
        configFile: PROJECT_PATH.tests + '/karma.conf.js',
        singleRun: true
    }, done);

    server.start();
});
github plasma-umass / browsix / gulpfile.js View on Github external
gulp.task('test-browser', ['dist-test'], function(done) {
    new karma.Server({
        configFile: __dirname + '/karma.conf.js',
        singleRun: false,
        autoWatchBatchDelay: 1000,
    }, done).start();

    gulp.watch(['src/**/*.ts', 'test/*.ts'], ['dist-test']);
});