From 423c757f1d2f89179a46d1bab4a661c53929e354 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Thu, 13 Mar 2014 11:21:03 +0100 Subject: [PATCH] chore(testsuite): organize tests into node/browser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces a clean separation of node and browser tests. ALL tests should be organized according to where they are run non browser (áka node tests): `test/spec/node` browser tests: `test/spec/browser` --- .gitignore | 1 + Gruntfile.js | 36 ++++--- example/index.html | 22 ++-- lib/{model/BpmnModel.js => Model.js} | 8 +- package.json | 20 ++-- test/spec/Helper.js | 100 ------------------ test/spec/Matchers.js | 53 ++++++++++ .../{BpmnModelSpec.js => ModelSpec.js} | 4 +- test/spec/node/Helper.js | 51 +++++++++ .../BpmnModelSpec.js => node/ModelSpec.js} | 13 ++- .../adapter/cmof/GenerateBpmnJsonSpec.js | 12 ++- test/spec/{model => node}/xml/ReadSpec.js | 11 +- .../spec/{model => node}/xml/RoundtripSpec.js | 49 ++++++--- test/spec/{model => node}/xml/WriteSpec.js | 12 +-- 14 files changed, 217 insertions(+), 175 deletions(-) rename lib/{model/BpmnModel.js => Model.js} (80%) delete mode 100644 test/spec/Helper.js create mode 100644 test/spec/Matchers.js rename test/spec/browser/{BpmnModelSpec.js => ModelSpec.js} (89%) create mode 100644 test/spec/node/Helper.js rename test/spec/{model/BpmnModelSpec.js => node/ModelSpec.js} (94%) rename test/spec/{model => node}/adapter/cmof/GenerateBpmnJsonSpec.js (94%) rename test/spec/{model => node}/xml/ReadSpec.js (98%) rename test/spec/{model => node}/xml/RoundtripSpec.js (74%) rename test/spec/{model => node}/xml/WriteSpec.js (86%) diff --git a/.gitignore b/.gitignore index 470a1ab7..4fd6ab50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ +bower_components/ tmp/ docs/ dist/ diff --git a/Gruntfile.js b/Gruntfile.js index 2a94d8bb..6f071280 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -26,7 +26,7 @@ module.exports = function(grunt) { }, jasmine_node: { specNameMatcher: '.*Spec', - projectRoot: 'test/spec/model', + projectRoot: 'test/spec/node', jUnit: { report: true, savePath : 'tmp/reports/jasmine', @@ -56,16 +56,17 @@ module.exports = function(grunt) { browserify: { options: { alias: [ - '<%= config.sources %>/main.js:Bpmn', - '<%= config.sources %>/model/BpmnModel.js:BpmnModel' + '<%= config.sources %>/main.js:bpmn', + '<%= config.sources %>/Model.js:bpmn/Model' ] }, - src: { + sources: { files: { '<%= config.dist %>/bpmn.js': [ '<%= config.sources %>/**/*.js' ] }, options: { - debug: true + debug: true, + transform: [ 'debowerify' ] } }, dist: { @@ -74,7 +75,7 @@ module.exports = function(grunt) { }, options: { debug: false, - transform: [ 'uglifyify' ] + transform: [ 'debowerify', 'uglifyify' ] } } }, @@ -93,12 +94,16 @@ module.exports = function(grunt) { }, watch: { sources: { - files: [ '<%= config.sources %>/**/*.js'], - tasks: [ 'browserify:src'] + files: [ '<%= config.sources %>/**/*.js', '<%= config.samples %>/**/*.*' ], + tasks: [ 'browserify:sources', 'copy:samples' ] + }, + samples: { + files: [ '<%= config.samples %>/**/*.*' ], + tasks: [ 'copy:samples' ] }, jasmine_node: { - files: [ '<%= config.sources %>/**/*.js', '<%= config.tests %>/spec/model/**/*.js'], - tasks: [ 'jasmine_node'] + files: [ '<%= config.sources %>/**/*.js', '<%= config.tests %>/spec/node/**/*.js' ], + tasks: [ 'jasmine_node' ] } }, jsdoc: { @@ -111,7 +116,7 @@ module.exports = function(grunt) { } }, concurrent: { - 'sources': [ 'browserify:src', 'jshint' ], + 'sources': [ 'browserify:sources', 'jshint' ], 'build': [ 'jshint', 'build', 'jsdoc' ] }, connect: { @@ -128,20 +133,21 @@ module.exports = function(grunt) { ] } } - }, + } }); // tasks grunt.registerTask('test', [ 'jasmine_node', 'karma:single' ]); - grunt.registerTask('build', [ 'browserify', 'copy:samples' ]); + grunt.registerTask('build', [ 'browserify:dist', 'copy:samples' ]); + grunt.registerTask('auto-build', [ - 'concurrent:build', + 'concurrent:sources', 'connect:livereload', 'watch' ]); - grunt.registerTask('auto-test', [ 'jasmine_node', 'watch:test' ]); + grunt.registerTask('auto-test', [ 'jasmine_node', 'watch:jasmine_node' ]); grunt.registerTask('default', [ 'jshint', 'test', 'build', 'jsdoc' ]); }; \ No newline at end of file diff --git a/example/index.html b/example/index.html index b850fe90..c9093419 100644 --- a/example/index.html +++ b/example/index.html @@ -6,11 +6,16 @@
Drop files here
+
+ + +