Cleanup: Add unit-tests task to grunt test, fix style checks

And improve success logging in unit-tests.

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-05-15 15:15:03 -07:00
parent b9b9abf76a
commit cb296fcfaa
No known key found for this signature in database
GPG key ID: A4931C09644C654B
2 changed files with 5 additions and 5 deletions

View file

@ -378,14 +378,14 @@ module.exports = function(grunt) {
console.error(results.reports); console.error(results.reports);
failure = function() { failure = function() {
grunt.fail.fatal('Found ' + results.failures + ' failing unit tests.'); grunt.fail.fatal('Found ' + results.failures + ' failing unit tests.');
} };
} else { } else {
console.log(results.passes + ' tests passed.'); grunt.log.ok(results.passes + ' tests passed.');
} }
}).catch(function (error) { }).catch(function (error) {
failure = function() { failure = function() {
grunt.fail.fatal('Something went wrong: ' + error.stack); grunt.fail.fatal('Something went wrong: ' + error.stack);
} };
}).then(function () { }).then(function () {
// We need to use the failure variable and this early stop to clean up before // We need to use the failure variable and this early stop to clean up before
// shutting down. Grunt's fail methods are the only way to set the return value, // shutting down. Grunt's fail methods are the only way to set the return value,
@ -467,7 +467,7 @@ module.exports = function(grunt) {
grunt.registerTask('tx', ['exec:tx-pull', 'locale-patch']); grunt.registerTask('tx', ['exec:tx-pull', 'locale-patch']);
grunt.registerTask('dev', ['default', 'connect', 'watch']); grunt.registerTask('dev', ['default', 'connect', 'watch']);
grunt.registerTask('test', ['jshint', 'jscs' ]); grunt.registerTask('test', ['jshint', 'jscs', 'unit-tests']);
grunt.registerTask('copy_dist', ['gitinfo', 'copy']); grunt.registerTask('copy_dist', ['gitinfo', 'copy']);
grunt.registerTask('date', ['gitinfo', 'getExpireTime']); grunt.registerTask('date', ['gitinfo', 'getExpireTime']);
grunt.registerTask('prep-release', ['gitinfo', 'clean-release', 'fetch-release']); grunt.registerTask('prep-release', ['gitinfo', 'clean-release', 'fetch-release']);

View file

@ -8,7 +8,7 @@ describe('i18n', function() {
}); });
it('returns message with single substitution', function() { it('returns message with single substitution', function() {
const actual = i18n('attemptingReconnection', 5); const actual = i18n('attemptingReconnection', 5);
assert.equal(actual, 'Attempting reconnect in 5 seconds') assert.equal(actual, 'Attempting reconnect in 5 seconds');
}); });
it('returns message with multiple substitutions', function() { it('returns message with multiple substitutions', function() {
const actual = i18n('verifyContact', ['<strong>', '</strong>']); const actual = i18n('verifyContact', ['<strong>', '</strong>']);