title: How to manage to exit phantomJS launcher after tests execution?
body: <p>I am writing angular 2 app and trying to setup test on Gitlab CI using phantomJS launcher.
  After all tests pass ok phantomJS launcher remains active forever(<a href="https://i.imgur.com/TD7cLdq.png" rel="nofollow noreferrer">http://i.imgur.com/TD7cLdq.png</a>). How I can manage to exit after test successfully passed?</p>
  
  <p>Here is my <code>package.json</code>:</p>
  
  <pre><code>{
    "name": "kibernum-dnc-client",
    "version": "0.0.0",
    "license": "MIT",
    "angular-cli": {},
    "scripts": {
      "ng": "ng",
      "start": "ng serve",
      "lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check &amp;&amp; tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
      "test": "ng test --browsers PhantomJS",
      "testd": "ng test --browsers Chrome",
      "pree2e": "webdriver-manager update --standalone false --gecko false",
      "e2e": "protractor"
    },
    "private": true,
    "dependencies": {
      "@angular/common": "^2.3.1",
      "@angular/compiler": "^2.3.1",
      "@angular/core": "^2.3.1",
      "@angular/forms": "^2.3.1",
      "@angular/http": "^2.3.1",
      "@angular/platform-browser": "^2.3.1",
      "@angular/platform-browser-dynamic": "^2.3.1",
      "@angular/router": "^3.3.1",
      "core-js": "^2.4.1",
      "rxjs": "^5.0.1",
      "ts-helpers": "^1.1.1",
      "zone.js": "^0.7.2"
    },
    "devDependencies": {
      "@angular/compiler-cli": "^2.3.1",
      "@types/jasmine": "2.5.38",
      "@types/node": "^6.0.42",
      "angular-cli": "1.0.0-beta.25.5",
      "codelyzer": "~2.0.0-beta.1",
      "jasmine-core": "2.5.2",
      "jasmine-spec-reporter": "2.5.0",
      "karma": "1.2.0",
      "karma-chrome-launcher": "^2.0.0",
      "karma-cli": "^1.0.1",
      "karma-jasmine": "^1.0.2",
      "karma-phantomjs-launcher": "^1.0.2",
      "karma-remap-istanbul": "^0.2.1",
      "phantomjs-prebuilt": "^2.1.14",
      "protractor": "~4.0.13",
      "ts-node": "1.2.1",
      "tslint": "^4.3.0",
      "typescript": "~2.0.3"
    }
  }
  </code></pre>
  
  <p>and here is my <code>karma.conf.js</code>:</p>
  
  <pre><code>module.exports = function (config) {
    config.set({
      basePath: '',
      frameworks: ['jasmine', 'angular-cli'],
      plugins: [
        require('karma-jasmine'),
        require('karma-chrome-launcher'),
        require('karma-remap-istanbul'),
        require('angular-cli/plugins/karma'),
        require('karma-phantomjs-launcher'),
      ],
      phantomJsLauncher: {
        exitOnResourceError: true
      },
      files: [
        { pattern: './src/test.ts', watched: false }
      ],
      preprocessors: {
        './src/test.ts': ['angular-cli']
      },
      mime: {
        'text/x-typescript': ['ts','tsx']
      },
      remapIstanbulReporter: {
        reports: {
          html: 'coverage',
          lcovonly: './coverage/coverage.lcov'
        }
      },
      angularCli: {
        config: './angular-cli.json',
        environment: 'dev'
      },
      reporters: config.angularCli &amp;&amp; config.angularCli.codeCoverage
                ? ['progress', 'karma-remap-istanbul']
                : ['progress'],
      port: 9876,
      colors: true,
      logLevel: config.LOG_INFO,
      autoWatch: true,
      browsers: ['Chrome', 'PhantomJS'],
      singleRun: true
    });
  };
  </code></pre>
  
  <p>Command to execute test is <code>npm run test</code>.</p>
  
  <p>Even with <code>singleRun: true</code> launcher stays forever.</p>
  
  <p>Here is example project: <a href="https://github.com/gandra/angular-testing-demo" rel="nofollow noreferrer">https://github.com/gandra/angular-testing-demo</a></p>
  
  <p>Steps to reprocue problem:</p>
  
  <pre><code>git clone https://github.com/gandra/angular-testing-demo
  cd angular-testing-demo
  npm install
  npm run test
  </code></pre>
  
  <p><strong>Expected:</strong>
  Test pass ok and exit console
  But this not happens :(</p>