This repository has been archived by the owner on Dec 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Default export/import from external module is not working as expected when running coverage #96
Comments
+1 |
I need this fix too! +1 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
I tried to analyse what is happening, and seems that:
So a few systems are involved. I'm not familiar enough with the systems to know where to change what to get this working. Options I see:
I used the hack below when creating a systemjs bundle. This seems to work in a very small test project. I doubt it will work for more complex project that include non es6 modules, but I will give it a try: Inside the option object of the builder.bundle call, add the following
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Default export/import from external module is not working as expected when running coverage
Hello,
I've found an issue when using an external module/library which provides a default export.
The external module is compiled from es6 -> es5 with systemjs. When i import this external module
foo.js
in mybar.js
everything works, as expected, in the browser as well as in my unit tests.
But as soon as i enable the coverage and prepreprocessor options in karma.conf.js my test will fail.
I have created a small project to illustrate the issue: https://github.com/kkluijtmans/module-bar
The external module can be found in
lib/module-foo.js
The
bar.js
injs/bar.js
When running the test with coverage
js/bar.spec.js
is called which importsbar.js
via theimport {foo, fooName} from './bar.js';
statementThe following is happening
bar.js
:es5ModuleFoo
is resolved as{"default":{"name":"foo"}}
but it should be resolved as{"name":"foo"}
I've added several log statements in
bar.js
to illustrate the issue and added more info in my readme.md from the module-bar projectThe es6 version of
foo.js
fromlib/module-foo.js
looks like this:Am i doing something wrong or is this really a bug?
The text was updated successfully, but these errors were encountered: