mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 11:33:09 +00:00
updated test runner
This commit is contained in:
parent
fc88a1094b
commit
ed77eb948b
4 changed files with 74 additions and 19 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -42,3 +42,5 @@ examples/deps/Tone.dat.gui.js
|
|||
examples/deps/dat.gui.js
|
||||
|
||||
test/mainTest.js
|
||||
|
||||
test/Main.js
|
||||
|
|
|
@ -2,6 +2,7 @@ require.config({
|
|||
baseUrl:"./",
|
||||
paths : {
|
||||
"Tone" : "../Tone",
|
||||
"Test" : "helper/Test"
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,18 @@ var uglify = require("gulp-uglify");
|
|||
var rename = require("gulp-rename");
|
||||
var sass = require("gulp-ruby-sass");
|
||||
var prefix = require("gulp-autoprefixer");
|
||||
var open = require("gulp-open");
|
||||
var openFile = require("gulp-open");
|
||||
var argv = require("yargs")
|
||||
.alias("f", "file")
|
||||
.alias("s", "signal")
|
||||
.alias("i", "instrument")
|
||||
.alias("o", "source")
|
||||
.alias("t", "structure")
|
||||
.alias("e", "effect")
|
||||
.alias("c", "core")
|
||||
.alias("m", "component")
|
||||
.argv;
|
||||
var webserver = require("gulp-webserver");
|
||||
|
||||
/**
|
||||
* BUILDING
|
||||
|
@ -111,18 +122,59 @@ gulp.task("example", function() {
|
|||
gulp.watch(["../examples/style/examples.scss"], ["sass"]);
|
||||
});
|
||||
|
||||
/**
|
||||
* THE WEBSERVER
|
||||
*/
|
||||
gulp.task("server", function(){
|
||||
gulp.src("../")
|
||||
.pipe(webserver({
|
||||
// livereload: false,
|
||||
directoryListing: true,
|
||||
port : 3000,
|
||||
open: false
|
||||
}));
|
||||
});
|
||||
|
||||
/**
|
||||
* Test Runners
|
||||
* TEST RUNNER
|
||||
*/
|
||||
gulp.task("test", ["collectTests"], function(){
|
||||
gulp.src("../test/test.html")
|
||||
.pipe(open());
|
||||
gulp.task("test", ["server", "collectTests"], function(){
|
||||
gulp.src("../test/index.html")
|
||||
.pipe(openFile({uri: "http://localhost:3000/test"}));
|
||||
});
|
||||
|
||||
gulp.task("collectTests", function(done){
|
||||
var tests = ["../test/*/*.js", "!../test/helper/*.js", "!../test/tests/*.js"];
|
||||
if (argv.file){
|
||||
tests = ["../test/*/"+argv.file+".js"];
|
||||
} else if (argv.signal || argv.core || argv.component || argv.instrument ||
|
||||
argv.source || argv.effect || argv.structure){
|
||||
tests = [];
|
||||
if (argv.signal){
|
||||
tests.push("../test/signal/*.js");
|
||||
}
|
||||
if (argv.core){
|
||||
tests.push("../test/core/*.js");
|
||||
}
|
||||
if (argv.source){
|
||||
tests.push("../test/source/*.js");
|
||||
}
|
||||
if (argv.instrument){
|
||||
tests.push("../test/instrument/*.js");
|
||||
}
|
||||
if (argv.component){
|
||||
tests.push("../test/component/*.js");
|
||||
}
|
||||
if (argv.effect){
|
||||
tests.push("../test/effect/*.js");
|
||||
}
|
||||
if (argv.structure){
|
||||
tests.push("../test/structure/*.js");
|
||||
}
|
||||
}
|
||||
// console.log(argv.signal === undefined);
|
||||
var allFiles = [];
|
||||
var task = gulp.src(["../test/Test/*/*.js"])
|
||||
var task = gulp.src(tests)
|
||||
.pipe(tap(function(file){
|
||||
var fileName = path.relative("../test/", file.path);
|
||||
allFiles.push(fileName.substring(0, fileName.length - 3));
|
||||
|
@ -132,7 +184,7 @@ gulp.task("collectTests", function(done){
|
|||
allFiles.unshift("Test");
|
||||
var innerTask = gulp.src("./fragments/test.frag")
|
||||
.pipe(replace("{FILES}", JSON.stringify(allFiles)))
|
||||
.pipe(rename("mainTest.js"))
|
||||
.pipe(rename("Main.js"))
|
||||
.pipe(gulp.dest("../test/"));
|
||||
innerTask.on("end", done);
|
||||
});
|
||||
|
|
|
@ -4,19 +4,22 @@
|
|||
"description": "gulp build system for Tone.js",
|
||||
"main": "gulpfile.js",
|
||||
"dependencies": {
|
||||
"gulp": "^3.8.11",
|
||||
"del": "^1.1.1",
|
||||
"amd-optimize": "^0.4.3",
|
||||
"del": "^1.1.1",
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-autoprefixer": "^2.3.1",
|
||||
"gulp-concat": "^2.5.2",
|
||||
"gulp-concat-css": "^2.2.0",
|
||||
"gulp-indent": "^1.0.0",
|
||||
"gulp-insert": "^0.4.0",
|
||||
"gulp-tap": "^0.1.3",
|
||||
"gulp-replace": "^0.5.3",
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"gulp-open": "^1.0.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-autoprefixer": "^2.3.1",
|
||||
"gulp-concat-css": "^2.2.0",
|
||||
"gulp-ruby-sass": "^1.0.5"
|
||||
"gulp-replace": "^0.5.3",
|
||||
"gulp-ruby-sass": "^1.0.5",
|
||||
"gulp-tap": "^0.1.3",
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"gulp-webserver": "^0.9.1",
|
||||
"yargs": "^3.21.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
@ -27,8 +30,5 @@
|
|||
"Tone.js"
|
||||
],
|
||||
"author": "Yotam Mann",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"gulp-open": "^1.0.0"
|
||||
}
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue