From cb296fcfaab3075b8978cc4ee1c4dd6c49118d1f Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 15 May 2017 15:15:03 -0700 Subject: [PATCH] Cleanup: Add unit-tests task to grunt test, fix style checks And improve success logging in unit-tests. FREEBIE --- Gruntfile.js | 8 ++++---- test/i18n_test.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 95f324d5f..94bfd3313 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -378,14 +378,14 @@ module.exports = function(grunt) { console.error(results.reports); failure = function() { grunt.fail.fatal('Found ' + results.failures + ' failing unit tests.'); - } + }; } else { - console.log(results.passes + ' tests passed.'); + grunt.log.ok(results.passes + ' tests passed.'); } }).catch(function (error) { failure = function() { grunt.fail.fatal('Something went wrong: ' + error.stack); - } + }; }).then(function () { // 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, @@ -467,7 +467,7 @@ module.exports = function(grunt) { grunt.registerTask('tx', ['exec:tx-pull', 'locale-patch']); 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('date', ['gitinfo', 'getExpireTime']); grunt.registerTask('prep-release', ['gitinfo', 'clean-release', 'fetch-release']); diff --git a/test/i18n_test.js b/test/i18n_test.js index d8b6f8cf9..aea603f5c 100644 --- a/test/i18n_test.js +++ b/test/i18n_test.js @@ -8,7 +8,7 @@ describe('i18n', function() { }); it('returns message with single substitution', function() { 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() { const actual = i18n('verifyContact', ['', '']);