0

Whenever I try to test a component which is using eventemitter2 and tries to make a new instance of it so for example import EventEmitter from 'eventemitter2' and then new EventEmitter() in my spec files, it throws an error TypeError: _eventemitter2.default is not a constructor. Any ideas what could cause this issue? Thank you.

update: It happens also in Jasmine and Mocha

Wojciech Jeleń
  • 389
  • 2
  • 11
  • shouldn't it be `import {EventEmitter2} from 'eventemitter2'`? – Andreas Köberle Aug 16 '17 at 11:13
  • Actually you are right, it works this way-thank you, but on the other hand `import EventEmitter from 'eventemitter2` works in clean npm project. is it possible it's somehow connected of how babel transorms ES6 Modules to CommonJS? – Wojciech Jeleń Aug 16 '17 at 11:46

0 Answers0