Skip to content

Commit

Permalink
Linting (including Karma file indent);
Browse files Browse the repository at this point in the history
    Babelify/Uglify/ESLint and add source maps for test worker;
    Avoid polyfill double-loading;
    Put test worker in test directory;
    Grunt: Reorder tasks to be more in normal order of execution;
    Load polyfill in worker for sake of PhantomJS tests;
    Overcome or workaround Karma/PhantomJS issues with workers,
    Documenting limitations;
    Remove ecmaFeatures:modules (not needed);
    Allow override of Saucekey env var.
    Rename web workers file to enable to execute first and avoid PhantomJS interaction problem with server-handlers.js;
    Promise rejection for bad schema callback or IDBKeyRange call
  • Loading branch information
brettz9 committed Mar 20, 2016
1 parent 52f5c01 commit 51b6e3d
Show file tree
Hide file tree
Showing 30 changed files with 703 additions and 235 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["es2015"]
"presets": ["es2015"],
"plugins": ["transform-es2015-modules-commonjs"]
}
88 changes: 56 additions & 32 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = function(grunt) {
module.exports = function (grunt) {
'use strict';
// Project configuration.
var saucekey = process.env.saucekey;

if (!saucekey) {
console.warn('Unable to load saucelabs key');
console.warn('Unable to load Saucelabs key');
}

grunt.initConfig({
Expand Down Expand Up @@ -51,83 +51,107 @@ module.exports = function(grunt) {
platform: 'Windows 2008'
}]
},
onTestComplete: function(result, callback) {
onTestComplete: function (result, callback) {
console.dir(result);
}
}
},

'babel': {
karma: {
options: {
configFile: 'karma.conf.js'
},
ci: {
singleRun: true,
browsers: ['PhantomJS']
},
dev: {
singleRun: false,
browsers: ['PhantomJS']
},
'dev-single': {
singleRun: true,
browsers: ['PhantomJS']
}
},

eslint: {
target: ['src/db.js', 'src/test-worker.js']
},

babel: {
options: {
sourceMap: true
},
dist: {
files: {
'dist/db.js': 'src/db.js'
'dist/db.js': 'src/db.js',
'tests/test-worker.js': 'src/test-worker.js'
}
}
},

'eslint': {
target: ['src/db.js']
browserify: {
dist: {
files: {
'dist/db.js': 'dist/db.js'
},
options: {
browserifyOptions: {
standalone: 'db'
}
}
}
},

uglify: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: 'dist/db.js.map' // input sourcemap from a previous compilation
sourceMapIncludeSources: true
},
dist: {
dbjs: {
options: {
sourceMapIn: 'dist/db.js.map' // input sourcemap from a previous compilation
},
files: {
'dist/db.min.js': ['dist/db.js']
}
}
},

karma: {
options: {
configFile: 'karma.conf.js'
},
ci: {
singleRun: true,
browsers: ['PhantomJS']
},
dev: {
singleRun: false,
browsers: ['PhantomJS']
},
'dev-single': {
singleRun: true,
browsers: ['PhantomJS']
testworker: {
options: {
sourceMapIn: 'tests/test-worker.js.map' // input sourcemap from a previous compilation
},
files: {
'tests/test-worker.js': ['tests/test-worker.js']
}
}
}
});

// load all grunt tasks
require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);

grunt.registerTask('forever', function() {
grunt.registerTask('forever', function () {
this.async();
});

var devJobs = ['eslint', 'babel', 'uglify', 'clean', 'jade'];
var devJobs = ['eslint', 'babel', 'browserify', 'uglify', 'clean', 'jade'];
var testJobs = devJobs.concat('connect');
if (saucekey && !process.env.TRAVIS_PULL_REQUEST) {
console.info('adding saucelabs integration');
console.info('adding Saucelabs integration');
testJobs.push('saucelabs-mocha');
}

if (process.env.TRAVIS_JOB_ID) {
testJobs = testJobs.concat('karma:ci');
testJobs.push('karma:ci');
} else {
testJobs.push('karma:dev-single');
}

grunt.registerTask('dev', devJobs);
grunt.registerTask('test', testJobs);
grunt.registerTask('default', 'test');
grunt.registerTask('test:local', function() {
grunt.registerTask('test:local', function () {
grunt.task.run(devJobs);
grunt.task.run('connect:server:keepalive');
});
Expand Down
Loading

0 comments on commit 51b6e3d

Please sign in to comment.