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:
parent
a83b71239b
commit
26b8490672
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,3 +16,4 @@ node_modules/
|
|||||||
nosetests.xml
|
nosetests.xml
|
||||||
*~
|
*~
|
||||||
*.orig
|
*.orig
|
||||||
|
js/test/lib/
|
||||||
|
|||||||
@ -20,6 +20,25 @@ module.exports = function (grunt) {
|
|||||||
all: {}
|
all: {}
|
||||||
},
|
},
|
||||||
browserify: {
|
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: {
|
dist: {
|
||||||
files: {
|
files: {
|
||||||
"<%= meta.files.concat %>": "<%= meta.files.main %>"
|
"<%= meta.files.concat %>": "<%= meta.files.main %>"
|
||||||
@ -68,8 +87,9 @@ module.exports = function (grunt) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask("test", ["jshint", "buster"]);
|
grunt.registerTask("test_build", ["browserify:test_when", "browserify:test_mopidy"]);
|
||||||
grunt.registerTask("build", ["test", "browserify", "uglify"]);
|
grunt.registerTask("test", ["jshint", "test_build", "buster"]);
|
||||||
|
grunt.registerTask("build", ["test", "browserify:dist", "uglify"]);
|
||||||
grunt.registerTask("default", ["build"]);
|
grunt.registerTask("default", ["build"]);
|
||||||
|
|
||||||
grunt.loadNpmTasks("grunt-buster");
|
grunt.loadNpmTasks("grunt-buster");
|
||||||
|
|||||||
12
js/buster.js
12
js/buster.js
@ -2,23 +2,13 @@ var config = module.exports;
|
|||||||
|
|
||||||
config.browser_tests = {
|
config.browser_tests = {
|
||||||
environment: "browser",
|
environment: "browser",
|
||||||
libs: [
|
libs: ["test/lib/*.js"],
|
||||||
"lib/bane-*.js",
|
|
||||||
"lib/when-define-shim.js",
|
|
||||||
"lib/when-*.js"
|
|
||||||
],
|
|
||||||
sources: ["src/**/*.js"],
|
|
||||||
testHelpers: ["test/**/*-helper.js"],
|
testHelpers: ["test/**/*-helper.js"],
|
||||||
tests: ["test/**/*-test.js"]
|
tests: ["test/**/*-test.js"]
|
||||||
};
|
};
|
||||||
|
|
||||||
config.node_tests = {
|
config.node_tests = {
|
||||||
environment: "node",
|
environment: "node",
|
||||||
libs: [
|
|
||||||
"lib/bane-*.js",
|
|
||||||
"lib/when-define-shim.js",
|
|
||||||
"lib/when-*.js"
|
|
||||||
],
|
|
||||||
sources: ["src/**/*.js"],
|
sources: ["src/**/*.js"],
|
||||||
testHelpers: ["test/**/*-helper.js"],
|
testHelpers: ["test/**/*-helper.js"],
|
||||||
tests: ["test/**/*-test.js"]
|
tests: ["test/**/*-test.js"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user