diff --git a/.gitignore b/.gitignore index fd08d6cc39..f37bbca21e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .rvmrc .DS_Store .bundle +_SpecRunner*.html dump.rdb db/*.sqlite3 log @@ -54,7 +55,6 @@ vendor/cache/* Vagrantfile node_modules .grunt/* -_SpecRunner.html vendor/assets/javascripts/cartodb.* vendor/assets/stylesheets/cartodb.* public/test_support.csv diff --git a/Gruntfile.js b/Gruntfile.js index d9f6312754..2b6269ec1b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -35,12 +35,6 @@ assets_dir: ASSETS_DIR, root_assets_dir: ROOT_ASSETS_DIR, - browserify_modules: { - tests: { - dest: '.grunt/browserify_modules_tests.js' - } - }, - // Concat task concat: require('./lib/build/tasks/concat').task(), @@ -154,11 +148,16 @@ grunt.registerTask('jasmine-server', 'start web server for jasmine tests in browser', function() { grunt.task.run('jasmine:cartodbui:build'); + grunt.task.run('jasmine:editor3:build'); grunt.event.once('connect.jasmine.listening', function(host, port) { var specRunnerUrl = 'http://localhost:' + port + '/_SpecRunner.html'; grunt.log.writeln('Jasmine specs available at: ' + specRunnerUrl); require('open')(specRunnerUrl); + + var specRunnerUrlForEditor3 = 'http://localhost:' + port + '/_SpecRunner-editor3.html'; + grunt.log.writeln('Jasmine specs available at: ' + specRunnerUrlForEditor3); + require('open')(specRunnerUrlForEditor3); }); grunt.task.run('connect:jasmine:keepalive'); diff --git a/lib/assets/test/spec/editor3/deep-insights.spec.js b/lib/assets/test/spec/editor3/deep-insights.spec.js new file mode 100644 index 0000000000..25c9cf04aa --- /dev/null +++ b/lib/assets/test/spec/editor3/deep-insights.spec.js @@ -0,0 +1,8 @@ +var cdb = require('cartodb-deep-insights.js'); + +describe('cartodb-deep-insights.js', function () { + it('should provide an API on the cdb namespace', function () { + expect(cdb).toBeDefined(); + expect(cdb.deepInsights).toBeDefined(); + }); +}); diff --git a/lib/build/files/browserify_files.js b/lib/build/files/browserify_files.js index a2a2651f7e..5507aa4d48 100644 --- a/lib/build/files/browserify_files.js +++ b/lib/build/files/browserify_files.js @@ -38,11 +38,6 @@ module.exports = { 'lib/assets/javascripts/cartodb/editor.js' ] }, - editor3: { - src: [ - 'lib/assets/javascripts/editor3.js' - ] - }, dashboard: { src: [ 'lib/assets/javascripts/cartodb/dashboard/entry.js' @@ -97,6 +92,21 @@ module.exports = { 'lib/assets/test/spec/cartodb/feed/**/*.spec.js', 'lib/assets/test/spec/cartodb/explore/**/*.spec.js' ], - dest: '<%= browserify_modules.tests.dest %>' + dest: '.grunt/browserify_modules_tests.js' + }, + + editor3: { + src: [ + 'lib/assets/javascripts/editor3.js' + ] + }, + 'editor3-specs': { + src: [ + 'lib/build/source-map-support.js', + + // Add specs for browserify module code here: + 'lib/assets/test/spec/editor3/**/*.spec.js' + ], + dest: '.grunt/editor3-specs.js' } }; diff --git a/lib/build/files/js_files.js b/lib/build/files/js_files.js index 1cdef4e291..f9702e51e5 100644 --- a/lib/build/files/js_files.js +++ b/lib/build/files/js_files.js @@ -156,7 +156,7 @@ module.exports = files = { '!lib/assets/test/spec/cartodb/feed/**/*.js', '!lib/assets/test/spec/cartodb/explore/**/*.js', '!lib/assets/test/spec/cartodb/editor/**/*.js', - '<%= browserify_modules.tests.dest %>' + '.grunt/browserify_modules_tests.js' ], _spec_helpers: [ diff --git a/lib/build/tasks/jasmine.js b/lib/build/tasks/jasmine.js index 106501f8f1..5b73d42df8 100644 --- a/lib/build/tasks/jasmine.js +++ b/lib/build/tasks/jasmine.js @@ -15,12 +15,25 @@ 'lib/build/test_init.js']), options: { keepRunner: true, //do not delete _SpecRunner.html, added in .gitignore so won't be versioned anyway. + outfile: '_SpecRunner.html', summary: true, display: 'short', specs: js_files.specs, helpers: ['http://maps.googleapis.com/maps/api/js?sensor=false&v=3.12'].concat(js_files._spec_helpers) //'--remote-debugger-port': 9000 } + }, + + editor3: { + src: [], // specs require their src files they need + options: { + outfile: '_SpecRunner-editor3.html', + summary: true, + display: 'short', + specs: [ + '.grunt/editor3-specs.js' + ] + } } - } + }; }; diff --git a/lib/build/tasks/watch.js b/lib/build/tasks/watch.js index 66ec5e02a7..b227bd6ed6 100644 --- a/lib/build/tasks/watch.js +++ b/lib/build/tasks/watch.js @@ -37,7 +37,10 @@ exports.task = function() { files: [ 'public/assets/<%= pkg.version %>/stylesheets/*.css', 'public/assets/<%= pkg.version %>/javascripts/*.js', - '<%= browserify_modules.tests.dest %>' // makes jasmine-server to rerun tests on test files' changes too + + // makes jasmine-server to re-run tests on test bundles generated by browserify + '.grunt/browserify_modules_tests.js', + '.grunt/editor3-specs.js' ], options: { livereload: true