How do I configure Angular2 Fast Launch to run phantomjs?

I am trying to figure out how to run Angular2 Quickstart tests using phantomjs.

I thought these steps were enough to set up Karma:

1. Clone the repository

$ git clone https://github.com/angular/quickstart.git


$ cd quickstart

2. Install phantomjs and the phantomjs launcher

$ npm install --save-dev phantomjs


$ npm install --save-dev karma-phantomjs-launcher

3. Modify karma.conf.js

// First change
require ('karma-chrome-launcher') => require ('karma-phantomjs-launcher')

// Second change
browsers: ['Chrome'] => browsers: ['PhantomJS']

4. Installing the Quickstart application

$ npm install

5. Run tests

$ npm run test-once

The following error is reported:

PhantomJS 2.1.1 (Linux 0.0.0) ERROR TypeError: undefined is not a function (evaluate "System.config") at karma-test-shim.js: 30

What am I missing or something amiss?

Thank.

+2


source to share


1 answer


The error before that: 404 trying to find system-polyfills.js

.

404: /base/node_modules/systemjs/dist/system-polyfills.js

If you add this to the karma config, the error goes away.



files: [
  // System.js for module loading
  'node_modules/systemjs/dist/system.src.js',
  'node_modules/systemjs/dist/system-polyfills.js',

      

Not really sure what the difference is (why not need it for Chrome). I assume this question is yours. You have to ask them.

+3


source







All Articles