Open jdubie opened 12 years ago
Hi Jack,
Thanks for the comment! This is admittedly a work in progress -- before I look closer did you check out the README? I'm not crazy about the way tests actually run in brunch and I do them a bit differently with this skeleton. Specifically:
With this skeleton, run npm test instead of brunch test or npm start in addition to brunch watch in order to automatically run tests. This runs the tests directly on the coffeescript files in test/ and utilizes NPM-installed test libraries instead of static ones from test/vendor/ as other skeletons do.
So tests are all headless on this skeleton (that sounds really weird). I'll look at adding your change so they might work both ways but was curious if you tried tests my way
Yes, I'm using your Makefile, make test
which runs
./node_modules/.bin/mocha \
--compilers coffee:coffee-script \
--reporter spec \
./test/*.coffee
So I added your suggestion for pulling from window
or node runtime; I think it's fine actually. In the tests themselves, requiring spine is more straightforward since they only run under node. Does this seem ok to you?
To clarify with spine plugins like Ajax, it seems like you could use the same convention:
Spine.Ajax = window?.Spine?.Ajax or require '../../node_modules/spine/src/ajax'
The deep link into the file system is not great... I wonder if the spine module could be changed to make this look nicer but I'm not quite sure. Maybe splitting up the library is more trouble than its worth?
Also as I'm pretty new to spine, does simply requiring 'spine' bring in all of the plugins?
I really like your choice of technologies in this repo but I'm unable to find a good way to test it using mocha. If you run this test in mocha in the nodejs runtime, Spine will not be defined. You can added
Spine = window?.Spine ? require('spine')
to the topapp/models/example_model
which will grab the global Spine in the browser and require the node_module spine in the nodejs runtime. However, this gets more complicated when you need Spine.Model.Ajax and Spine.Model.Relation.How you found a clean way to do this?
test/unit/example_model.coffee:
app/models/example_model.coffee: