Teatime
At featurefabrik, we are big fans of javascript and testing. We also believe, that mocha.js and chai.js are simply awesome. To remove the npm dependencies and enable fast and simple testing of non-Rails projects with js usage, we built Teatime.
For now, this is a proof of concept under heavy development. I just needed a quick solution for js-testing with mocha and chai.
Installation
Add this line to your application's Gemfile:
gem 'teatime'
or this to your gems .gemspec file:
spec.add_development_dependency "teatime"
And then execute:
$ bundle
Or install it yourself as:
$ gem install teatime
Usage
Initialie your tests with rake teatime:init
. This will create the directory
test/javascripts
, a test_helper.js
file in that directory and a Teafile
with configurable settings in your project root.
You can now fire up your testsuite with:
rake teatime:serve
It will automatically load all all js files in lib/**/*.js
and all tests that
match the pattern test/javascript/**/*_test.js
.
No need to restart the server, if you add any files. All *_test.js
files are
evaluated in the regular mocha.js scope, just use describe(..)
or which
interface you like. You can set/change the mocha.js or chai.js settings in
test_helper.js
.
Happy testing :)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request