integrate mocha

This commit is contained in:
Philipp Kunz 2016-02-01 03:10:58 +01:00
parent 6a884cda78
commit 774269da57
7 changed files with 36 additions and 169425 deletions

View File

@ -1,31 +1,29 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
console.log("**** starting test ****");
var plugins = { var plugins = {
beautylog: require("beautylog"), beautylog: require("beautylog"),
gulp: require("gulp"), gulp: require("gulp"),
gulpBrowser: require("../index.js"), gulpBrowser: require("../index.js"),
gulpCallFunction: require("gulp-callfunction") gulpCallFunction: require("gulp-callfunction")
}; };
var pipeWorked = function () { describe("gulpBrowser", function () {
plugins.beautylog.info("Pipe didn't break! Ready for Primetime!"); describe(".browserify", function () {
}; it("should run through smoothly", function (done) {
plugins.beautylog.log('Now trying to browserify a testfile...'); this.timeout(15000);
plugins.gulp.task('gulpBrowserTest', function (cb) { plugins.gulp.task('gulpBrowserNormal', function (cb) {
var stream = plugins.gulp.src('./testassets/browserifyGulpTest.js') var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
.pipe(plugins.gulpBrowser.browserify()) .pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("./testassets/result/")) .pipe(plugins.gulp.dest("./test/result/"))
.pipe(plugins.gulpCallFunction(pipeWorked)); .pipe(plugins.gulpCallFunction(done));
return stream; return stream;
});
plugins.gulp.start.apply(plugins.gulp, ['gulpBrowserNormal']);
});
});
}); });
plugins.gulp.task('gulpBrowserTestError', function (cb) { plugins.gulp.task('gulpBrowserTestError', function (cb) {
plugins.beautylog.info("Expecting an error:"); plugins.beautylog.info("Expecting an error:");
var stream = plugins.gulp.src('./testassets/browserifyGulpTestError.js') var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
.pipe(plugins.gulpBrowser.browserify()) .pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("./testassets/result/")) .pipe(plugins.gulp.dest("./test/result/"));
.pipe(plugins.gulpCallFunction(pipeWorked));
return stream; return stream;
}); });
plugins.gulp.task("default", ['gulpBrowserTest', 'gulpBrowserTestError'], function () {
plugins.beautylog.success("Test passed!");
});
plugins.gulp.start.apply(plugins.gulp, ['default']);

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
var myError = require("my-error");

View File

@ -1,5 +1,4 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
console.log("**** starting test ****");
var plugins = { var plugins = {
beautylog: require("beautylog"), beautylog: require("beautylog"),
gulp: require("gulp"), gulp: require("gulp"),
@ -7,28 +6,26 @@ var plugins = {
gulpCallFunction: require("gulp-callfunction") gulpCallFunction: require("gulp-callfunction")
}; };
describe("gulpBrowser",function(){
var pipeWorked = function() { describe(".browserify",function(){
plugins.beautylog.info("Pipe didn't break! Ready for Primetime!"); it("should run through smoothly",function(done){
}; this.timeout(15000);
plugins.gulp.task('gulpBrowserNormal',function(cb) {
plugins.beautylog.log('Now trying to browserify a testfile...'); var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
plugins.gulp.task('gulpBrowserTest',function(cb) {
var stream = plugins.gulp.src('./testassets/browserifyGulpTest.js')
.pipe(plugins.gulpBrowser.browserify()) .pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("./testassets/result/")) .pipe(plugins.gulp.dest("./test/result/"))
.pipe(plugins.gulpCallFunction(pipeWorked)); .pipe(plugins.gulpCallFunction(done));
return stream; return stream;
});
plugins.gulp.start.apply(plugins.gulp, ['gulpBrowserNormal']);
});
});
}); });
plugins.gulp.task('gulpBrowserTestError',function(cb) { plugins.gulp.task('gulpBrowserTestError',function(cb) {
plugins.beautylog.info("Expecting an error:"); plugins.beautylog.info("Expecting an error:");
var stream = plugins.gulp.src('./testassets/browserifyGulpTestError.js') var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
.pipe(plugins.gulpBrowser.browserify()) .pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("./testassets/result/")) .pipe(plugins.gulp.dest("./test/result/"))
.pipe(plugins.gulpCallFunction(pipeWorked));
return stream; return stream;
}); });
plugins.gulp.task("default",['gulpBrowserTest','gulpBrowserTestError'],function(){
plugins.beautylog.success("Test passed!");
});
plugins.gulp.start.apply(plugins.gulp, ['default']);

View File

@ -1,6 +1,7 @@
{ {
"ambientDependencies": { "ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9", "browserify": "github:DefinitelyTyped/DefinitelyTyped/browserify/browserify.d.ts#3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9",
"browserify": "github:DefinitelyTyped/DefinitelyTyped/browserify/browserify.d.ts#3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9" "mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9"
} }
} }