Breaks karma testing with phantomjs
See original GitHub issueBelow is the error received when running karma with phantomjs:
04 02 2017 23:00:40.353:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
04 02 2017 23:00:40.355:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
04 02 2017 23:00:40.359:INFO [launcher]: Starting browser PhantomJS
04 02 2017 23:00:40.997:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket -cO0ACHZ7ins7g78AAAA with id 58034973
PhantomJS 2.1.1 (Mac OS X 0.0.0) LOG: 'Attempting to configure 'style' with descriptor '{"enumerable":true,"configurable":true}' on object '[object HTMLHtmlElement]' and got error, giving up: TypeError: Attempting to configurable attribute of unconfigurable property.'
PhantomJS 2.1.1 (Mac OS X 0.0.0) LOG: 'Attempting to configure 'style' with descriptor '{"enumerable":true,"configurable":true}' on object '[object HTMLHtmlElement]' and got error, giving up: TypeError: Attempting to configurable attribute of unconfigurable property.'
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
TypeError: undefined is not a constructor (evaluating 'b.style._set(a.propertyName(c),d)')
at webpack:///~/web-animations-js/web-animations.min.js:15:0 <- src/polyfills.ts:3498
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
TypeError: undefined is not a constructor (evaluating 'b.style._set(a.propertyName(c),d)')
at webpack:///~/web-animations-js/web-animations.min.js:15:0 <- src/polyfills.ts:3498
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Karma jasmine test fails when running on PhantomJS
What was breaking my code was a duplicate key in my angular template. Wow. Ahh the joys of being a web developer.
Read more >Faster Karma test runs that work in VSTS with Chrome ...
Most examples I've seen use PhantomJS as a headless browser, and it works ok. But on my current project, we have 4,700+ JavaScript...
Read more >Javascript Testing with Jasmine and Karma - Eldarion
As for the Karma test runner, I needed the karma-jquery adapter so ... Lastly, since we will be running these tests in PhantomJS...
Read more >Using PhantomJS With Karma - DZone
This guide will walk through the process of generating a new Angular application, configuring PhantomJS in the Karma test runner, ...
Read more >Headless OPA5 testing with Karma and PhantomJS - SAP Blogs
To match this, OPA5 tests can be run with Karma and PhantomJS. While Karma will serve the files to the browser without the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I pretty much had the same issue as described her when i updated angular cli to 1.0.0 and angular to 4.0.1 today.
This is the solution i came up with, which seems to work so i wanted to briefly how i managed to solve it.
I created a new project with angular cli and saw that the polyfill.ts template has changed:
as you can see there is a new entry for web-animations which i uncommented (as well as most of the other polyfills):
Afterwards i removed the web-animations from my script section in .angular-cli.json
Then all my tests ran already, besides the one where the component actually uses animations. To solve this, i import the NoopAnimationsModule and it works 😃
This pretty much solved the problem. Now for me it would be interesting if this also works for you and if you think thus is a “proper” solution.
Thanks and best regards, Matthias
I had a similar problem. Initially I tried to import BrowserAnimationsModule per the suggestion (in the app I also had to import this for the animations to work), but in PhantomJS the test still didn’t work until I replaced BrowserAnimationsModule with NoopAnimationsModule.