-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
karma support for ES6 modules #2903
Comments
Please submit your fix as a pull request so it goes through all of the prerequisite testing. I would be happy to review a PR to introduce this feature. |
Thanks for the quick reply! I tried, NPM test is failing on a clean checkout, for reasons unclear to me:
npm version 5.5.1 Please advice on how to proceed. If this cannot be fixed within the short term, perhaps this could be taken care of by a custom karma middleware plugin for now? I am not sure though, I could not find any clear documentation on this subject yet. Thanks! |
@fvanderwielen
I'm aware it's only an temporary solution, but maybe this tip will help someone to investigate/fix problem. |
I'm not able to contribute a PR due to failing Karma own test. The above work around works, but once it's fixed, the other error emerge, like |
See #2942 concerning the Proxy fail |
I have seen that the first part is integrated in karma 2.0.0: you have to specify files with (see https://karma-runner.github.io/2.0/config/files.html) For the second part, I have opened a second bug #2955, where I am trying to make a PR... |
Hey Karma team, We use Karma and Karma Closure runner for unit testing. I wonder if you have an ETA about when Karma will support ES6 modules? Thanks, |
I don't see any Pull Requests adding support for Es6 modules |
Thank you for the response! I am wondering if Karma team plans to provide this ES6 module support soon, or it is low priority for the team so we need to wait for other contributors to add it? |
I believe there are or will be users motivated to contribute this feature. |
There is some work already done here: #2834 |
It would be great to have this implemented. |
Does anybody managed to get it working with imports from |
Could anybody please implement this? If not, I will try to do it myself (taking the above experiences) and make a PR, just don't want to invest my time if someone else does it too. I would prefer somebody experienced with Karma do it, but if nobody will, I can at least try. |
Based on #3072 this feature is implemented. Please check the documentation, and if it is inadequate please send a fix. Or if the feature is incomplete, please open a detailed explanation. |
That is correct, after further experiments I managed to get it to work without modifying the karma code. Sorry for the confusion, I am still new to configuring karma (used it with Angular only so far) and seeing that issue open made me think I am doing it correctly - my mistake, I wasn't :). |
Expected behaviour
Wiht most browsers landed ES6 modules in their current releases ( https://caniuse.com/#feat=es6-module ), it would be nice to still be able to unit test this javascript in all these browsers using karma, without transpilation.
Actual behaviour
Tests do not run:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
Environment Details
karma --version
): 5.5.1karma.config.js
file:frameworks: ['jasmine'],Steps to reproduce the behaviour
Possible fix
I hacked my karma installation and jasmine adapter to get karma to run ES6 modules with latest stable chrome. To do so, I modified the following:
var SCRIPT_TYPE = { '.js': /* 'text/javascript', //HACK--> */ 'module', '.dart': 'application/dart' }
// serve karma.js, context.js, and debug.js var jsFiles = ['/karma.js', '/context.js', '/debug.js', '/karma-start.js']
` %SCRIPTS% <script type="module" src="karma-start.js"></script>
`
window.__karma__.loaded();
The text was updated successfully, but these errors were encountered: