-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
index.test.js
94 lines (75 loc) · 2.5 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
'use strict';
var cp = require('child_process');
var path = require('path');
var expect = require('expect');
var gulp = require('../');
describe('gulp', function() {
describe('hasOwnProperty', function() {
it('src', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'src')).toEqual(true);
done();
});
it('dest', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'dest')).toEqual(true);
done();
});
it('symlink', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'symlink')).toEqual(true);
done();
});
it('watch', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'watch')).toEqual(true);
done();
});
it('task', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'task')).toEqual(true);
done();
});
it('series', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'series')).toEqual(true);
done();
});
it('parallel', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'parallel')).toEqual(true);
done();
});
it('tree', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'tree')).toEqual(true);
done();
});
it('lastRun', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'lastRun')).toEqual(true);
done();
});
it('registry', function(done) {
expect(Object.prototype.hasOwnProperty.call(gulp, 'registry')).toEqual(true);
done();
});
});
it('can run against gulpfile.cjs', function (done) {
this.timeout(5000);
var cli = path.join(__dirname, '../bin/gulp.js');
var opts = { cwd: path.join(__dirname, 'fixtures/gulpfiles/cjs' ) };
cp.exec('node ' + cli, opts, function (err, stdout, stderr) {
expect(err).toBeNull();
expect(stdout).toMatch('gulpfile.cjs');
expect(stderr).toEqual('');
done();
});
});
it('can run against gulpfile.mjs', function (done) {
// Node v10 didn't support `exports` in package.json
if (process.version.startsWith('v10.')) {
this.skip();
}
this.timeout(5000);
var cli = path.join(__dirname, '../bin/gulp.js');
var opts = { cwd: path.join(__dirname, 'fixtures/gulpfiles/mjs' ) };
cp.exec('node ' + cli, opts, function (err, stdout, stderr) {
expect(err).toBeNull();
expect(stdout).toMatch('gulpfile.mjs');
expect(stderr).toEqual('');
done();
});
});
});