From 2cd43a7c2a24886d66eebc92f6ca0238ba2a7cba Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Fri, 9 Dec 2016 13:49:18 -0500 Subject: [PATCH] better commonjs test (clean dist, consistent test) - removed commonjs testing resource (js/npm.js) from dist folder - buld dist task no longer leaves dist/js/npm.js in zip - moved creation of resources for commonjs into prep test task - test dist task now preps for commonjs tasks and cleans up --- .gitignore | 1 + dist/js/npm.js | 24 ------------------------ grunt/config/clean.js | 3 ++- grunt/tasks/build.js | 4 ++-- grunt/tasks/test.js | 14 ++++++++++---- 5 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 dist/js/npm.js diff --git a/.gitignore b/.gitignore index f18a7e729..985172929 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ FUEL_CDN.yml # Generated file from commonjs-test.js test/commonjs-bundle.js +dist/npm.js # Editors / IDEs .idea diff --git a/dist/js/npm.js b/dist/js/npm.js deleted file mode 100644 index 75f9373cc..000000000 --- a/dist/js/npm.js +++ /dev/null @@ -1,24 +0,0 @@ -// This file has been created by the `commonjs` Grunt task. You can require() this file in a CommonJS environment. -require('jquery'); -require('bootstrap'); - -require('../../js/checkbox'); -require('../../js/combobox'); -require('../../js/datepicker'); -require('../../js/dropdown-autoflip'); -require('../../js/loader'); -require('../../js/placard'); -require('../../js/radio'); -require('../../js/search'); -require('../../js/selectlist'); -require('../../js/spinbox'); -require('../../js/tree'); -require('../../js/utilities'); -require('../../js/wizard'); -require('../../js/infinite-scroll'); -require('../../js/pillbox'); -require('../../js/repeater'); -require('../../js/repeater-list'); -require('../../js/repeater-thumbnail'); -require('../../js/scheduler'); -require('../../js/picker'); \ No newline at end of file diff --git a/grunt/config/clean.js b/grunt/config/clean.js index f572a4fa6..1efd0530b 100644 --- a/grunt/config/clean.js +++ b/grunt/config/clean.js @@ -1,5 +1,6 @@ module.exports = { + commonjs: ['dist/js/npm.js', 'test/commonjs-bundle.js'], dist: ['dist'], zipsrc: ['dist/fuelux'], screenshots: ['page-at-timeout-*.jpg'] -}; \ No newline at end of file +}; diff --git a/grunt/tasks/build.js b/grunt/tasks/build.js index 2d68b2339..e0776a2cf 100644 --- a/grunt/tasks/build.js +++ b/grunt/tasks/build.js @@ -28,7 +28,7 @@ module.exports = function(grunt) { // Full distribution task grunt.registerTask('dist', 'Build "dist." Contributors: do not commit "dist."', - ['clean:dist', 'distcss', 'copy:fonts', 'copy:templates', 'distjs', 'commonjs', 'distzip']); + ['clean:dist', 'distcss', 'copy:fonts', 'copy:templates', 'distjs', 'distzip']); -}; \ No newline at end of file +}; diff --git a/grunt/tasks/test.js b/grunt/tasks/test.js index 43b49cb13..f3d40490f 100644 --- a/grunt/tasks/test.js +++ b/grunt/tasks/test.js @@ -1,15 +1,21 @@ module.exports = function test (grunt) { // to be run prior to submitting a PR grunt.registerTask('test', 'run jshint, qunit source w/ coverage, and validate HTML', - ['jshint', 'connect:testServer', 'qunit:noMoment', 'qunit:globals', 'qunit:dist', 'htmllint']); + ['jshint', 'connect:testServer', 'qunit:noMoment', 'qunit:globals', 'test-dist', 'htmllint']); + + grunt.registerTask('prep-commonjs-test', 'run commonjs config buiild and browserify to prep for commonjs test', + ['commonjs', 'browserify:commonjs']); + + grunt.registerTask('test-dist', 'run jshint, qunit source w/ coverage, and validate HTML', + ['dist', 'prep-commonjs-test', 'qunit:dist', 'clean:commonjs']); // If qunit:source is working but qunit:full is breaking, check to see if the dist broke the code. This would be especially useful if we start mangling our code, but, is 99.99% unlikely right now grunt.registerTask('validate-dist', 'run qunit:source, dist, and then qunit:full', - ['connect:testServer', 'qunit:source', 'dist', 'browserify:commonjs', 'qunit:dist']); + ['connect:testServer', 'qunit:source', 'test-dist']); // multiple jQuery versions, then run SauceLabs VMs grunt.registerTask('releasetest', 'run jshint, build dist, all source tests, validation, and qunit on SauceLabs', - ['test', 'dist', 'browserify:commonjs', 'qunit:dist', 'saucelabs-qunit:defaultBrowsers']); + ['test', 'saucelabs-qunit:defaultBrowsers']); // Due to TravisCI security concerns, Saucelabs can not be run for PRs from forks. Therefore, it can not become part of our PR process. // https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions @@ -18,7 +24,7 @@ module.exports = function test (grunt) { ['connect:testServer', 'jshint', 'saucelabs-qunit:defaultBrowsers']); grunt.registerTask('travisci', 'Tests to run when in Travis CI environment', - ['browserify:commonjs', 'test', 'dist', 'qunit:dist']); + ['test']); // if you've already accidentally added your files for commit, this will at least unstage them. If you haven't, this will wipe them out. grunt.registerTask('resetdist', 'resets changes to dist to keep them from being checked in', function resetdist () {