yeoman/generator-backbone

Is each spec file created supposed to be run during `grunt test`?

Closed this issue · 3 comments

Hi - I'm trying to understand running and building tests for my Models, Views, etc. When I create a new model, a new spec file is created. I expected that this would equate to another test but it seems the only test being run is in test/spec/test.js. Is there something additional I need to do to get the spec files to run?

It seems like the generator isn't adding the new spec files to test/index.html. Thanks for letting us know!

Thanks for the tip @arthurvr. There is also the issue that test/index.html doesn't include other scripts like main.js and bower components are not being added. This causes any spec file you do add to test/index.html to fail for all sorts of reasons, for one that the main app variable doesn't exist. Also that if you set up any markup in the body field it won't be there in the test... Seems like maybe the test/index.html file should be built on grunt test by taking the app/index.html file and inserting the required mocha items. Those being (as far as I can tell)...

In body:

 <div id="mocha"></div>
    <script src="bower_components/mocha/mocha.js"></script>
    <script>mocha.setup('bdd')</script>
    <script src="bower_components/chai/chai.js"></script>
    <script>
        var assert = chai.assert;
        var expect = chai.expect;
        var should = chai.should();
    </script>

    <!-- include spec files here... -->
    <script src="models/Game.spec.js"></script>

    <script>mocha.run()</script>

I created a new issue for this #364