Skip to content

Instantly share code, notes, and snippets.

@wingsuitist
Created July 5, 2017 09:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wingsuitist/c2c3095b855e9f1054d39df13a317f52 to your computer and use it in GitHub Desktop.
Save wingsuitist/c2c3095b855e9f1054d39df13a317f52 to your computer and use it in GitHub Desktop.
karma.conf.js: Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS. Raw Raw
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-phantomjs-launcher'), /* add PhantomJS launcher here */
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
/*...*/
browsers: ['Chrome', 'PhantomJS'], /* add PhatomJS here */
singleRun: false
});
};
@brunoocasali
Copy link

@wingsuitist
Your GitLab's C.I. stop after run all tests? Because you are using "singleRun: false", how to deal with this? Can you share your gitlab-ci.yml too?

@melroy89
Copy link

melroy89 commented Mar 19, 2018

@brunoocasali
You can override this singlerun via the CLI. For example:

ng test --browsers ChromeHeadless --single-run=true

This means that the singleRun boolean in the karma.conf.js file can stay on false. (or visa versa if you like)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment