I've switched to Angular4.0.0-rc.1 and it looks like ES5 testing bundles contain ES2015 code.
I'm getting this error:
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
SyntaxError: Unexpected token 'const'
at webpack:///~/@angular/core/@angular/core/testing.es5.js:10:0 <- src/test.ts:16345
Also found related issue on Angular repo.
I just created a basic Angular project and had the same (or similar) issue with PhantomJS integration.
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
SyntaxError: Unexpected token 'const'
at webpack:///src/app/app.component.ts:1:0 <- src/test.ts:63184
PhantomJS is a headless (aka, no GUI) browser that can be used for automated testing. Currently, PhantomJS has a limitation in that it only supports the ES5 standard.
npm install -g phantomjs-prebuiltnpm install --save-dev karma-phantomjs-launcher
require('karma-phantomjs-launcher') to the plugins sectionPhantomJS to the browsersnpm install --save intl
import 'intl'; (uncomment at the bottom)import "core-js/client/shim"; to the Evergreen requirements sectiones5.Assuming all goes well, testing should work.
Some examples on how to trigger a test run:
ng test --browsers PhantomJS --singleRun true./node_modules/karma/bin/karma start ./karma.conf.js --browsers PhantomJS --singleRun trueIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With