You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Why using AMD instead of CommonJs for testing ? #3
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.
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 :).
Activity
vojtajina commentedon Nov 5, 2014
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 commentedon Nov 5, 2014
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.