Commit 8e04ea51 authored by JC Brand's avatar JC Brand

Add grunt task to run the tests.

- Removed phantom-jasmine, not used.
- Updated CONTRIBUTING.rst
parent c85c9f04
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Contributing to Converse.js Contributing to Converse.js
=========================== ===========================
Thanks for contributing to Converse.js_! Thanks for contributing to Converse.js_.
Please follow the usual github workflow. Create your own local fork of this repository, Please follow the usual github workflow. Create your own local fork of this repository,
make your changes and then submit a pull request. make your changes and then submit a pull request.
...@@ -19,12 +19,19 @@ for testing. ...@@ -19,12 +19,19 @@ for testing.
Take a look at ``tests.html`` and ``spec/MainSpec.js`` to see how Take a look at ``tests.html`` and ``spec/MainSpec.js`` to see how
the tests are implemented. the tests are implemented.
If you are unsure how to write tests, please `contact me`_ and I'll be happy to
help.
Check that the tests run Check that the tests run
------------------------ ------------------------
Check that the Jasmine BDD tests complete sucessfully. Open tests.html in your Check that the Jasmine tests complete sucessfully. Open tests.html in your
browser, and the tests will run automatically. browser, and the tests will run automatically.
You can see the current test output online, here: http://conversejs.org/tests.html You can see the current test output online, here: http://conversejs.org/tests.html
On the command line you can run ``grunt test`` (if you have before run ``npm
install``).
.. _Converse.js: http://conversejs.org .. _Converse.js: http://conversejs.org
.. _`contact me`: http://opkode.com/contact.html
...@@ -16,5 +16,23 @@ module.exports = function(grunt) { ...@@ -16,5 +16,23 @@ module.exports = function(grunt) {
} }
}); });
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('default', ['jshint']); grunt.registerTask('test', 'Run Tests', function () {
var done = this.async();
var child_process = require('child_process');
var exec = child_process.exec;
exec('phantomjs '+
'node_modules/jasmine-reporters/test/phantomjs-testrunner.js '+
__dirname+'/tests.html',
function (err, stdout, stderr) {
if (err) {
grunt.log.write('Tests failed with error code '+err.code);
grunt.log.write(stderr);
}
grunt.log.write(stdout);
done();
});
});
grunt.registerTask('default', 'Perform all checks (e.g. before releasing)', function () {
grunt.task.run('jshint', 'test');
});
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment