Setup tests for editor3 code

All .spec.js files added to the new editor3 dir will be included, so no
need to add specs manually for this new bundle
pull/6478/head
Nicklas Gummesson 9 years ago
parent 106f35aaf7
commit 8ff220b4ea

2
.gitignore vendored

@ -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

@ -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');

@ -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();
});
});

@ -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'
}
};

@ -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: [

@ -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'
]
}
}
}
};
};

@ -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

Loading…
Cancel
Save