theintern / intern-tutorial

Learn how to use Intern by following this tutorial!
http://theintern.io
144 stars 44 forks source link

CommonJS tutorial - without AMD? #18

Closed ninjasort closed 9 years ago

ninjasort commented 9 years ago

is it possible to do a tutorial without AMD using just CommonJS?

jason0x43 commented 9 years ago

Intern tests must be written as AMD modules. However, they can use and test CommonJS modules, and can be written using a minimal form of the AMD wrapper that is very similar to CommonJS syntax. Check out the code examples in the new Intern guide.

dylans commented 9 years ago

Or see the example and discussion at https://github.com/theintern/intern-tutorial/issues/15#issuecomment-70301481 ... basically you can use an AMD module to load tests written as CJS modules.

neonstalwart commented 9 years ago

@dylans thanks - you caught me just in time. i was about to type all that again :smile:

jason0x43 commented 9 years ago

Interesting, hadn't seen that.

jason0x43 commented 9 years ago

Immortalized in a gist: https://gist.github.com/jason0x43/3e3c00265c3fc573b48d

ninjasort commented 9 years ago

thanks

ijy commented 9 years ago

Intern tests must be written as AMD modules.

I was sold on Intern until I got to this one factor. Why-o-why??

basically you can use an AMD module to load tests written as CJS modules.

But then you would need to learn and actively use both module systems just to write tests(?) Why force this upon users who will have their own preferences? @ericelliott has it bang on in his comments and I only see the sway growing towards CommonJS inspired module systems with ES6 Harmony setting the future direction and being very much on the near horizon. Forcing AMD style makes it a hard sell.

Very disappointing.

csnover commented 9 years ago

@ijy “Why-o-why” is described in the user guide under Conventions. Please take a look.

csnover commented 9 years ago

Also look at any of the links that @jason0x43 posted above.