Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Why using AMD instead of CommonJs for testing ? #3

Closed
JonathanDaSilva opened this issue Nov 3, 2014 · 2 comments
Closed

Why using AMD instead of CommonJs for testing ? #3

JonathanDaSilva opened this issue Nov 3, 2014 · 2 comments

Comments

@JonathanDaSilva
Copy link

I would like to know if they are a specifique reason to go with requirejs instead of your karma-commonjs preprocessor ?

Best Regards.

@vojtajina
Copy link
Contributor

Eventually, once the browsers support ES6 modules, you won't need any module loader. In the meantime, we will be probably using es6-module-loader (which is a polyfil according to the spec). On Angular 2.0 we are already using it. The reasons why I used RequireJS in this playground was that 1/people are more familiar with it 2/ you also need system.js + register extension to consume Traceur's output with es6-module-loader. Once we simplify this, I will probably change this playground to use es6-module-loader instead.

As you said, I could use CommonJS syntax and karma-commonjs plugin but I would still need some module loader such as mr or browserify to load the code in a browser (without Karma).

Sorry, I know this is pretty confusing.
Hope this explains. Feel free to ask more questions.

@JonathanDaSilva
Copy link
Author

Thanks for the response. I understand. This question came because for unit testing, if you use requirejs you need a javascript file for setting all this up (test/main.js). With karma-commonjs you can do all out of the box and I think it's less confussing :).

Anyway thanks.

Sorry for my poor english.
Regards.

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

2 participants