From 41c5408a4a6347a360ec250c1ae0f62d40585559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Gomes?= Date: Fri, 11 Sep 2015 13:37:45 +0100 Subject: [PATCH] Adding a mocha:closure gulp task, to test closure-compiled JS. Also reorders mocha task to only happen after JS tasks, and improves two unit tests by moving code in "describe" blocks to "before" blocks. --- gulpfile.js | 23 ++++++++++++++++++++--- test/index.html | 17 +---------------- test/unit/menu.js | 13 +++++++++---- test/unit/tabs.js | 43 ++++++++++++++++++++++++++----------------- 4 files changed, 56 insertions(+), 40 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 53084661..9a87955b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -270,20 +270,22 @@ gulp.task('metadata', function() { }); // Build Production Files, the Default Task -gulp.task('default', ['clean', 'mocha'], function(cb) { +gulp.task('default', ['clean'], function(cb) { runSequence( ['styles', 'styles-grid'], ['scripts'], + ['mocha'], cb); }); // Build production files and microsite -gulp.task('all', ['clean', 'mocha'], function(cb) { +gulp.task('all', ['clean'], function(cb) { runSequence( ['default', 'styletemplates'], ['styles:gen'], ['jshint', 'jscs', 'scripts', 'assets', 'demos', 'pages', 'templates', 'images', 'styles-grid', 'metadata'], + ['mocha'], ['zip'], cb); }); @@ -295,7 +297,22 @@ gulp.task('mocha', ['styles'], function() { .pipe($.mochaPhantomjs({reporter: 'tap'})); }); -gulp.task('test', ['jshint', 'jscs', 'mocha']); +gulp.task('mocha:closure', ['closure'], function() { + return gulp.src('./test/index.html') + .pipe($.replace('src="../dist/material.js"', + 'src="../dist/material.closure.min.js"')) + .pipe($.rename('temp.html')) + .pipe(gulp.dest('./test')) + .pipe($.mochaPhantomjs({reporter: 'tap'})) + .on('finish', function() { + del('test/temp.html', {'force': true}); + }) + .on('error', function() { + del('test/temp.html', {'force': true}); + }); +}); + +gulp.task('test', ['jshint', 'jscs', 'mocha', 'mocha:closure']); gulp.task('test:visual', function() { browserSync({ diff --git a/test/index.html b/test/index.html index 8604bea4..49347ab1 100644 --- a/test/index.html +++ b/test/index.html @@ -41,22 +41,7 @@ return bound; }; - - - - - - - - - - - - - - - - +