Updated the test process for mopidy.js

Following on from the previous issue #609 commits, I have updated the
build process to cater to the fact that the files are no longer
available to test in the browser environment.

2 new browserify tasks build the mopidy.js file and then when.js file
(available in node_modules.) These files are placed in test/lib/ (This
directory has been added to the .gitignore file) prior to the running of
the buster tests. As these files are ignored in the .gitignore, this
will prevent them from being committed to git and also prevent them from
being packaged up to npm.

Once the tests have completed, the main browserify task will run to
build the official browser release.
This commit is contained in:
Paul Connolley 2013-12-17 16:52:35 +00:00
parent a83b71239b
commit 26b8490672
3 changed files with 24 additions and 13 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ node_modules/
nosetests.xml
*~
*.orig
js/test/lib/

View File

@ -20,6 +20,25 @@ module.exports = function (grunt) {
all: {}
},
browserify: {
test_mopidy: {
files: {
"test/lib/mopidy.js": "<%= meta.files.main %>"
},
options: {
postBundleCB: function (err, src, next) {
next(null, grunt.template.process("<%= meta.banner %>") + src);
},
standalone: "Mopidy"
}
},
test_when: {
files: {
"test/lib/when.js": "node_modules/when/when.js"
},
options: {
standalone: "when"
}
},
dist: {
files: {
"<%= meta.files.concat %>": "<%= meta.files.main %>"
@ -68,8 +87,9 @@ module.exports = function (grunt) {
}
});
grunt.registerTask("test", ["jshint", "buster"]);
grunt.registerTask("build", ["test", "browserify", "uglify"]);
grunt.registerTask("test_build", ["browserify:test_when", "browserify:test_mopidy"]);
grunt.registerTask("test", ["jshint", "test_build", "buster"]);
grunt.registerTask("build", ["test", "browserify:dist", "uglify"]);
grunt.registerTask("default", ["build"]);
grunt.loadNpmTasks("grunt-buster");

View File

@ -2,23 +2,13 @@ var config = module.exports;
config.browser_tests = {
environment: "browser",
libs: [
"lib/bane-*.js",
"lib/when-define-shim.js",
"lib/when-*.js"
],
sources: ["src/**/*.js"],
libs: ["test/lib/*.js"],
testHelpers: ["test/**/*-helper.js"],
tests: ["test/**/*-test.js"]
};
config.node_tests = {
environment: "node",
libs: [
"lib/bane-*.js",
"lib/when-define-shim.js",
"lib/when-*.js"
],
sources: ["src/**/*.js"],
testHelpers: ["test/**/*-helper.js"],
tests: ["test/**/*-test.js"]