Skip to content
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

Option to generate tests using mocha/sinon/chai instead of jasmine #6

Open
traviskaufman opened this issue Dec 12, 2013 · 1 comment

Comments

@traviskaufman
Copy link

Hello! First off, thank you for such an awesome web application framework. I'm writing this as the contribution guide says to "ask first before embarking on any significant pull request"

I was using flight to build out an internal tool at my company, where we use mocha, sinon, and chai for testing our front-end code. I used this generator to initially set up the application, and noticed that switching out jasmine and using these libraries instead can take a bit of time. I love flight and plan on using it as my go-to framework for future projects, but I also prefer to use mocha/sinon/chai over jasmine, so it would be great if this generator could accept options to configure tests using them instead of jasmine.

Why mocha, sinon, and chai?

Since there is already a flight extensions for mocha, I figured that it should follow that the generator for mocha could support setting up tests for a framework which extensions have already been written.

I chose chai because it is a very robust assertion library but is also highly configurable and non-prescriptive about what kind of assertions you use (assert, expect, etc.). In fact, I'd also love to see some chai extensions for flight as well, but I digress.

I chose sinon because, well, personally I love sinon 😃 . But more than that also because I find it nicely fills in for jasmine's spies (and thensome), and also provides pretty much all utilities needed to easily perform js testing such as fake timers, XHRs, etc.

If you feel that adding sinon and chai are too prescriptive, however, I completely understand. But I feel at minimum there should be support for mocha.

As I mentioned in the first paragraph I am more than happy to implement this and submit a pull request for it. Flight has made my life a whole lot easier and ensures that the products shipped with it are always architected in a scalable and sensible way, so I'd love to be able to give back to it.

@necolas
Copy link
Contributor

necolas commented Dec 12, 2013

Hey. Mocha, Chai, and Sinon are my personal preference too (if IE 8 testing isn't needed). Happy for a Pull Request that adds the option(s) to the package generator.

There's already an open issue to implement these options in the generator-flight repo (our flight-based application generator; perhaps you meant to open this issue there?): flightjs/generator-flight#4. It should be much simple now that Yeoman's generator has a better prompt builder. You might want to look there too - https://github.com/flightjs/generator-flight/blob/master/lib/generators/app/index.js

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants