JavaScript testing strategies?


(Jimmy Bourassa) #1

I’m about to start a new project with Rails and Ember. We’ve used Rails and Ember separately, but never together. All Ember projects I’ve built used a Grunt-based workflow, but I’d really like to use Sprockets for simplicity’s sake. Since Discourse uses Sprockets I’m studying it’s organization to learn from it and see how I could structure my Ember app with it.

That said, I couldn’t find any JavaScript nor full integration test suite within Discourse. Is there or has there ever been such a test suite? That’s the only major element that seems lacking with a Rails/Sprockets based workflow. Any hints regarding that topic would be greatly appreciated.

Thanks!


(Robin Ward) #2

I should say that while we currently use Rails’ asset pipeline I would very much like to migrate us off it. I am currently in the process of converting our Javascript to use ES6 module syntax via a transpiler. Once that is done, we can look into using something like Broccoli outside the asset pipeline.

If you have the opportunity to start a new project fresh, I’d highly recommend ember-cli using proxying to your rails server.

We have about 1600 Javascript tests. If you have discourse installed and visit /qunit in development mode it will run the suite, which includes integration and unit tests.

Our javascript test suite lives here:


(Jimmy Bourassa) #3

@eviltrout Thank you very much for taking the time to answer. Your opinion definitely means a lot to me (and the community!). I was more and more leaning toward a non-Ruby solution to manage the JS app, and you just confirmed that choice.

Really not sure how I missed it. I was looking at specs and assets/*, but didn’t see the test folder. Duh!