-
-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathconfig-flags-tasks-depth.js
41 lines (33 loc) · 1.31 KB
/
config-flags-tasks-depth.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
'use strict';
var expect = require('expect');
var exec = require('child_process').exec;
var path = require('path');
var fs = require('fs');
var sliceLines = require('./tool/slice-lines');
var gulp = require('./tool/gulp-cmd');
var baseDir = path.join(__dirname, 'fixtures/config/flags/tasksDepth');
var expectedDir = path.join(__dirname, 'expected');
describe('config: flags.tasksDepth', function() {
it('Should limit depth of task list when `flags.tasksDepth` is specified', function(done) {
var opts = { cwd: baseDir };
exec(gulp('--tasks'), opts, cb);
function cb(err, stdout, stderr) {
var filepath = path.join(expectedDir, 'flags-tasks-depth4.txt');
var expected = fs.readFileSync(filepath, 'utf-8');
expect(sliceLines(stdout, 2)).toEqual(sliceLines(expected, 2));
expect(stderr).toEqual('');
done(err);
}
});
it('Should overridden by cli flag: --tasks-depth', function(done) {
var opts = { cwd: baseDir };
exec(gulp('--tasks', '--tasks-depth', '2'), opts, cb);
function cb(err, stdout, stderr) {
var filepath = path.join(expectedDir, 'flags-tasks-depth2.txt');
var expected = fs.readFileSync(filepath, 'utf-8');
expect(sliceLines(stdout, 2)).toEqual(sliceLines(expected, 2));
expect(stderr).toEqual('');
done(err);
}
});
});