Skip to content

Commit 8b4dfca

Browse files
committed
test: update tests a bit (with last changes of runtime)
1 parent 06e3227 commit 8b4dfca

File tree

4 files changed

+42
-45
lines changed

4 files changed

+42
-45
lines changed

test/cli.js

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -23,65 +23,61 @@ exports = module.exports = function (Gulp, util) {
2323
util.rimraf(test.dirname, done);
2424
});
2525

26-
var gulp = Gulp.create();
27-
2826
it('--silent should turn off logging', function (done) {
29-
gulp.stack('--silent', {
30-
onHandleError: done,
31-
onHandleEnd: function () {
32-
should(this.log).be.eql(false);
33-
done();
34-
gulp.log = true;
35-
}
36-
})();
27+
var gulp = Gulp.create();
28+
29+
gulp.log.should.be.eql(true);
30+
31+
gulp.start(['--silent'], function (error) {
32+
if (error) { return done(error); }
33+
should(gulp.log).be.eql(false);
34+
done();
35+
});
3736
});
3837

3938
it('--no-color should turn colors off', function (done) {
40-
gulp.stack('--no-color', {
41-
onHandleError: done,
42-
onHandleEnd: function () {
43-
should(util.lib.chalk).have.property('enabled', false);
44-
done();
45-
}
46-
})();
39+
var gulp = Gulp.create();
40+
41+
gulp.start(['--no-color'], function (error) {
42+
if (error) { return done(error); }
43+
should(util.lib.chalk).have.property('enabled', false);
44+
done();
45+
});
4746
});
4847

4948
it('--color should restore them', function (done) {
50-
gulp.stack('--color', {
51-
onHandleError: done,
52-
onHandleEnd: function () {
53-
should(util.lib.chalk).have.property('enabled', true);
54-
done();
55-
}
56-
})();
49+
var gulp = Gulp.create();
50+
51+
gulp.start(['--color'], function (error) {
52+
if (error) { return done(error); }
53+
should(util.lib.chalk).have.property('enabled', true);
54+
done();
55+
});
5756
});
5857

5958
it('--cwd :dirname should change cwd', function (done) {
6059
var cwd = process.cwd();
60+
var gulp = Gulp.create();
6161

62-
gulp.stack('--cwd ' + test.dirname, {
63-
onHandleError: done,
64-
onHandleEnd: function () {
65-
should(process.cwd()).be.eql(test.dirname);
66-
process.chdir(cwd); // restore previous working directory
67-
done();
68-
}
69-
})();
62+
gulp.start(['--cwd ' + test.dirname], function (error) {
63+
if (error) { return done(error); }
64+
should(process.cwd()).be.eql(test.dirname);
65+
process.chdir(cwd); // restore previous working directory
66+
done();
67+
});
7068
});
7169

7270
it('--require should require a module from the cwd', function (done) {
7371
var cwd = process.cwd();
72+
var gulp = Gulp.create();
73+
74+
should(require.cache).not.have.property(test.file);
7475

75-
gulp.stack('--require ' + test.file, {
76-
onHandleError: done,
77-
onHandleStart: function () {
78-
should(require.cache).not.have.property(test.file);
79-
},
80-
onHandleEnd: function () {
81-
should(require.cache).have.property(test.file);
82-
process.cwd().should.be.eql(cwd);
83-
done();
84-
}
85-
})();
76+
gulp.start(['--require ' + test.file], function (error) {
77+
if (error) { return done(error); }
78+
should(require.cache).have.property(test.file);
79+
process.cwd().should.be.eql(cwd);
80+
done();
81+
});
8682
});
8783
};

test/create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exports = module.exports = function (Gulp) {
1313

1414
it('create({log: false}) should disable logging', function () {
1515
var gulp = Gulp.create({log: false});
16+
gulp.props.log.should.be.eql(false);
1617
gulp.log.should.be.eql(false);
1718
});
1819

test/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
require('should');
44

5-
65
var Gulp = require('../');
76
var util = require('./util');
87

test/task.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
exports = module.exports = function (Gulp) {
4+
var should = require('should');
45

56
it('task(name, fn) registers task `name`', function () {
67
var gulp = Gulp.create();
@@ -52,7 +53,7 @@ exports = module.exports = function (Gulp) {
5253

5354
gulp.task('taskName', deps, function () {});
5455
gulp.stack('taskName')(function (error) {
55-
error.should.be.instanceof(Error);
56+
should(error).be.instanceof(Error);
5657
done();
5758
});
5859
});

0 commit comments

Comments
 (0)