marcopeg / grunt-mocha-chai-sinon

Simple test runner task for NodeJS
8 stars 3 forks source link

Missing documentation #4

Open Haraldson opened 9 years ago

Haraldson commented 9 years ago

It’s not obvious to me how to require in dependencies in the *.spec.js files. I’m sure I could learn it if I spent some more time reading up on Node, but wouldn’t it just be so much nicer if you provided some actual examples in the project’s readme?

marcopeg commented 9 years ago

Hi Hein, thank you for this issue, I will provide some examples.

Now I am on mobile but as soon as possible I'll add another message providing links to some other repos in which I use this module to tdd.

Write you soon, Marco On lun 5 gen 2015 at 11:06 Hein Haraldson Berg notifications@github.com wrote:

It’s not obvious to me how to require in dependencies in the *.spec.js files. I’m sure I could learn it if I spent some more time reading up on Node, but wouldn’t it just be so much nicer if you provided some actual examples in the project’s readme?

— Reply to this email directly or view it on GitHub https://github.com/marcopeg/grunt-mocha-chai-sinon/issues/4.

Haraldson commented 9 years ago

Great stuff, Marco! :)

Haraldson commented 9 years ago

Sorry to be all up in your business, @marcopeg, but if you’re on a more convenient platform now, those links really would help! :+1:

marcopeg commented 9 years ago

So far I can give you this: https://github.com/jqbrick

It's a side repository of mine that contains some NPM modules I wrote, search here for the "specs" folder to see some examples.

Today is my first day in a new firm so please hold on some two/three days for a more specific example.

On Tuesday, January 6, 2015, Hein Haraldson Berg notifications@github.com wrote:

Sorry to be all up in your business, @marcopeg https://github.com/marcopeg, but if you’re on a more convenient platform now, those links really would help! [image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/marcopeg/grunt-mocha-chai-sinon/issues/4#issuecomment-68838341 .

Best regards, Marco Pegoraro

m. marco.pegoraro@gmail.com C. +46 (0) 73 234 50 44


This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

marcopeg commented 9 years ago

Hi @Haraldson I finally got the time to add a brief example project.

Take a look here: https://github.com/marcopeg/grunt-mocha-chai-sinon/tree/I4-example-project/example

So far it is in a side branch so we can work on it together until the moment we merge it. Next days I will add some readme / comments for generating the code coverage.

I wait for your feedback.

Haraldson commented 9 years ago

I’ve done some more research myself, and for my part, the problem is AMD vs. CommonJS. I wonder if there’s a simple way to make this grunt task requirejs compatible, or in some way make AMD modules requirable by wrapping stuff with UMD wrappers, as seen over at https://github.com/umdjs/umd?

Either that, or at least document this limitation. :)

marcopeg commented 9 years ago

Ok, now I got something more. You are trying to use this repo with RequireJS which was not planned for.
This repo was specifically conceive to test pure NodeJS modules in a NodeJS environment.

I personally moved away from RequireJS toward WebPack for many reasons and today I provide a project setup which includes a full test suite here:

https://github.com/PoliteJS/workspace https://github.com/PoliteJS/workspace-examples