mercredi 17 mai 2017

Can't import component in spec.ts

I'm running into something weird...

I'm using Karma, Jasmine and Angular2 in a ionic 2 app.

I want to do some unit testing and I achieved to create a basic one which is always successful expect(true).toBe(true);

Now I want to test my components, but whenever I do import { MyComponent } from './myComponent'; I get an error as follows:

START:
Chrome 58.0.3029 (Linux 0.0.0) WARN: 'asmCrypto seems to be load from an insecure origin; this may cause to MitM-attack vulnerability. Consider using secure transport protocol.'
17 05 2017 22:41:28.303:WARN [reporter]: SourceMap position not found for trace: undefined
Chrome 58.0.3029 (Linux 0.0.0) ERROR
  Uncaught TypeError: Cannot read property 'prototype' of undefined
  at src/test.ts:168035

Finished in 1.318 secs / 0 secs @ 22:41:28 GMT+0200 (CEST)

SUMMARY:
✔ 0 tests completed

It probably has to do with the relative path as I tried to include a component from node_modules and terminal returned a success response.

Did anyone run into this error ?

Aucun commentaire:

Enregistrer un commentaire