switched to ES6 default import

This commit is contained in:
2016-10-19 01:10:45 +02:00
parent e10c31c740
commit 8a2c516274
7 changed files with 118 additions and 110 deletions

2
test/test.d.ts vendored
View File

@ -1 +1 @@
import "typings-test";
import 'typings-test';

File diff suppressed because one or more lines are too long

View File

@ -1,59 +1,59 @@
import "typings-test"
var gulp = require("gulp");
var gulpFunction = require("../dist/index.js");
var beautylog = require("beautylog");
var Q = require("q");
import 'typings-test'
let gulp = require('gulp');
import gulpFunction from '../dist/index'
let beautylog = require('beautylog')
let Q = require('q')
var myFunction = function () {
var done = Q.defer()
beautylog.log("Function executed");
let myFunction = function () {
let done = Q.defer()
beautylog.log('Function executed');
done.resolve();
return done.promise;
};
var myFunction2 = function () {
var done = Q.defer();
beautylog.ok("Function2 executed");
let myFunction2 = function () {
let done = Q.defer();
beautylog.ok('Function2 executed');
done.resolve();
return done.promise;
};
var myFunction3 = function () {
var done = Q.defer();
beautylog.success("Function3 executed");
let myFunction3 = function () {
let done = Q.defer();
beautylog.success('Function3 executed');
done.resolve();
return done.promise;
};
var beforeFunction = function () {
var done = Q.defer();
beautylog.success("beforeFunction executed");
let beforeFunction = function () {
let done = Q.defer();
beautylog.success('beforeFunction executed');
done.resolve();
return done.promise;
};
var middleFunctionRun = false;
let middleFunctionRun = false;
var middleFunction = function () {
var done = Q.defer();
beautylog.success("middleFunction executed");
let middleFunction = function () {
let done = Q.defer();
beautylog.success('middleFunction executed');
setTimeout(function(){
beautylog.log("timeout fired");
beautylog.log('timeout fired');
middleFunctionRun = true;
done.resolve();
}, 500);
return done.promise;
};
var afterFunction = function () {
var done = Q.defer();
beautylog.success("afterFunction executed");
let afterFunction = function () {
let done = Q.defer();
beautylog.success('afterFunction executed');
done.resolve();
return done.promise;
};
let timeoutFunction = function(){
var done = Q.defer();
let done = Q.defer();
setTimeout(function(){
beautylog.log("largeTimeout fired");
beautylog.log('largeTimeout fired');
done.resolve();
},2000);
return done.promise;
@ -61,56 +61,56 @@ let timeoutFunction = function(){
describe("gulpFunction",function(){
it("should run through smoothly with " + "'forEach'".blue,function(done){
describe('gulpFunction',function(){
it('should run through smoothly with ' + "'forEach'",function(done){
gulp.src('./test/*.md')
.pipe(gulpFunction(myFunction,'forEach'))
.pipe(gulp.dest("./test/result/"));
.pipe(gulp.dest('./test/result/'));
gulp.src('./test/*.md')
.pipe(gulpFunction([myFunction2,myFunction3],'forEach'))
.pipe(gulp.dest("./test/result/"))
.pipe(gulpFunction(done,"atEnd"));
.pipe(gulp.dest('./test/result/'))
.pipe(gulpFunction(done,'atEnd'));
});
it("should run through smoothly with " + "'atEnd'".blue,function(done){
it('should run through smoothly with ' + "'atEnd'",function(done){
gulp.src('./test/*.md')
.pipe(gulpFunction(myFunction,'atEnd'))
.pipe(gulp.dest("./test/result/"));
.pipe(gulp.dest('./test/result/'));
gulp.src('./test/*.md')
.pipe(gulpFunction([myFunction2,myFunction3],'atEnd'))
.pipe(gulp.dest("./test/result/"))
.pipe(gulpFunction(done,"atEnd"));
.pipe(gulp.dest('./test/result/'))
.pipe(gulpFunction(done,'atEnd'));
});
it("should run through smoothly once with " + "'atFirst'".blue,function(done){
it('should run through smoothly once with ' + "'atFirst'",function(done){
gulp.src('./test/*.md')
.pipe(gulpFunction([myFunction2,myFunction3],'forFirst'))
.pipe(gulp.dest("./test/result/"))
.pipe(gulpFunction(done,"atEnd"));
.pipe(gulp.dest('./test/result/'))
.pipe(gulpFunction(done,'atEnd'));
});
it("should run in order",function(done){
it('should run in order',function(done){
this.timeout(5000);
let stream = gulp.src('./test/*.md')
.pipe(gulpFunction([beforeFunction,middleFunction,middleFunction],'atEnd'))
.pipe(gulpFunction(function(){
beautylog.log("stream progressed");
var done2 = Q.defer();
beautylog.log('stream progressed');
let done2 = Q.defer();
done2.resolve();
return done2.promise;
},"forEach"))
},'forEach'))
.pipe(gulpFunction(function(){
beautylog.log("nextStep");
beautylog.log('nextStep');
}))
.pipe(gulpFunction(afterFunction,"atEnd"))
.pipe(gulpFunction(timeoutFunction,"atEnd"));
.pipe(gulpFunction(afterFunction,'atEnd'))
.pipe(gulpFunction(timeoutFunction,'atEnd'));
stream.on("finish",function(){
beautylog.info("stream finished");
stream.on('finish',function(){
beautylog.info('stream finished');
done();
});
});