Skip to content

Ng Test throws PhantomJS Linux Webpack DI Error #5078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bvkatwijk opened this issue Feb 27, 2017 · 5 comments
Closed

Ng Test throws PhantomJS Linux Webpack DI Error #5078

bvkatwijk opened this issue Feb 27, 2017 · 5 comments

Comments

@bvkatwijk
Copy link

OS?

Ubuntu 14.04.05 LTS

Versions.

@angular/cli: 1.0.0-rc.0
node: 6.9.5
os: linux x64

Repro steps.

  • Initialized app using angular cli
  • Replaced Chrome with PhantomJS adjusting karma.conf.js
  • Added lines to polyfills.ts:
    import 'intl'; // I ran: npm install --save intl
    import 'phantomjs-polyfill-object-assign'; // I ran: npm install --save-dev phantomjs-polyfill-object-assign
    import 'phantomjs-polyfill-array-from'; // I ran: npm install --save-dev phantomjs-polyfill-array-from

The log given by the failure.

27 02 2017 21:24:35.078:WARN [karma]: No captured browser, open http://localhost:9876/
27 02 2017 21:24:35.094:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
27 02 2017 21:24:35.095:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
27 02 2017 21:24:35.142:INFO [launcher]: Starting browser PhantomJS
27 02 2017 21:24:36.003:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket 3GqCFL2v8f9aYqRTAAAA with id 17882383
PhantomJS 2.1.1 (Linux 0.0.0) ERROR
Error: DI Error
at webpack:///~/@angular/core/src/di/reflective_injector.js:485:0 <- src/test.ts:59404

PhantomJS 2.1.1 (Linux 0.0.0) ERROR
Error: DI Error
at webpack:///~/@angular/core/src/di/reflective_injector.js:485:0 <- src/test.ts:59404

Mention any other details that might be useful.

  • I want to use a headless browser on Linux therefore I attempted to utilize PhantomJS.
  • When I open the logged browser url http://localhost:9876 in FireFox, the test process executes and all tests pass.
  • I added the two phantomjs polyfills to resolve errors about missing functions
@vigie
Copy link

vigie commented Feb 28, 2017

@bvkatwijk FYI I fixed this by un-commenting all of the core-js shims in polyfills.ts.

@Meligy
Copy link
Contributor

Meligy commented Feb 28, 2017

If what @vigie suggests doesn't fix it, someone else suggested that removing the following part from karma config is needed for phantomJS:

    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },

Maybe try that as well.

@Meligy
Copy link
Contributor

Meligy commented Feb 28, 2017

Also see another potential one #5065 (comment).

@filipesilva
Copy link
Contributor

Closing as answered.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants