Skip to content

Commit 090d601

Browse files
erikkempermanphated
authored andcommitted
Build: Ensure all callback arguments are tested
1 parent 7f0b050 commit 090d601

16 files changed

+89
-36
lines changed

test/completion.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ describe('flag: --completion', function() {
1616
.gulp('--completion=' + type)
1717
.run(cb);
1818

19-
function cb(err, stdout) {
19+
function cb(err, stdout, stderr) {
20+
expect(err).toNotExist();
21+
expect(stderr).toEqual('');
2022
expect(stdout).toEqual(expected);
2123
done(err);
2224
}
@@ -31,8 +33,9 @@ describe('flag: --completion', function() {
3133
.gulp('--completion=unknown')
3234
.run(cb);
3335

34-
function cb(err, stdout) {
35-
expect(err).toExist();
36+
function cb(err, stdout, stderr) {
37+
expect(err).toNotEqual(null);
38+
expect(stderr).toEqual('');
3639
expect(stdout).toEqual(expected);
3740
done();
3841
}
@@ -44,7 +47,9 @@ describe('flag: --completion', function() {
4447
.run(cb);
4548

4649
function cb(err, stdout, stderr) {
50+
expect(err).toNotEqual(null);
4751
expect(stderr).toMatch('Missing completion type');
52+
expect(stdout).toEqual('');
4853
done();
4954
}
5055
});

test/config-description.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ describe('config: description', function() {
2020
.gulp('--tasks')
2121
.run(cb);
2222

23-
function cb(err, stdout) {
23+
function cb(err, stdout, stderr) {
24+
expect(err).toEqual(null);
25+
expect(stderr).toEqual('');
2426
var expected = fs.readFileSync(path.join(expectedDir, 'output0.txt'),
2527
'utf-8');
2628
stdout = eraseTime(stdout);
@@ -36,7 +38,9 @@ describe('config: description', function() {
3638
.gulp('--tasks')
3739
.run(cb);
3840

39-
function cb(err, stdout) {
41+
function cb(err, stdout, stderr) {
42+
expect(err).toEqual(null);
43+
expect(stderr).toEqual('');
4044
var expected = fs.readFileSync(path.join(expectedDir, 'output0.txt'),
4145
'utf-8');
4246
stdout = eraseTime(skipLines(stdout, 1));
@@ -52,7 +56,9 @@ describe('config: description', function() {
5256
.gulp('--tasks', '--gulpfile ../foo/bar/gulpfile.js', '--cwd .')
5357
.run(cb);
5458

55-
function cb(err, stdout) {
59+
function cb(err, stdout, stderr) {
60+
expect(err).toEqual(null);
61+
expect(stderr).toEqual('');
5662
var expected = fs.readFileSync(path.join(expectedDir, 'output1.txt'),
5763
'utf-8');
5864
stdout = eraseTime(stdout);

test/config-flags-gulpfile.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ describe('config: flags.gulpfile', function() {
1717
.run(cb);
1818

1919
function cb(err, stdout, stderr) {
20+
expect(err).toEqual(null);
21+
expect(stderr).toEqual('');
2022
stdout = headLines(stdout, 2, 2);
2123
expect(stdout).toEqual(
2224
'This gulpfile : ' +
2325
path.join(fixturesDir, 'flags/gulpfile/is/here/mygulpfile.js') +
2426
'\n' +
2527
'The current directory : ' + path.join(fixturesDir, 'flags/gulpfile')
2628
);
27-
expect(stderr).toEqual('');
2829
done(err);
2930
}
3031
});
@@ -36,14 +37,15 @@ describe('config: flags.gulpfile', function() {
3637
.run(cb);
3738

3839
function cb(err, stdout, stderr) {
40+
expect(err).toEqual(null);
41+
expect(stderr).toEqual('');
3942
stdout = headLines(stdout, 2, 3);
4043
expect(stdout).toEqual(
4144
'This gulpfile : ' +
4245
path.join(fixturesDir, 'flags/gulpfile/is/here/mygulpfile.js') +
4346
'\n' +
4447
'The current directory : ' + path.join(fixturesDir, 'flags/gulpfile')
4548
);
46-
expect(stderr).toEqual('');
4749
done(err);
4850
}
4951
});
@@ -56,12 +58,13 @@ describe('config: flags.gulpfile', function() {
5658
.run(cb);
5759

5860
function cb(err, stdout, stderr) {
61+
expect(err).toEqual(null);
62+
expect(stderr).toEqual('');
5963
stdout = headLines(stdout, 1, 3);
6064
expect(stdout).toEqual(
6165
'Another gulpfile : ' +
6266
path.join(fixturesDir, 'flags/gulpfile/cwd/gulpfile.js')
6367
);
64-
expect(stderr).toEqual('');
6568
done(err);
6669
}
6770
});
@@ -74,12 +77,13 @@ describe('config: flags.gulpfile', function() {
7477
.run(cb);
7578

7679
function cb(err, stdout, stderr) {
80+
expect(err).toEqual(null);
81+
expect(stderr).toEqual('');
7782
stdout = headLines(stdout, 1, 3);
7883
expect(stdout).toEqual(
7984
'Another gulpfile : ' +
8085
path.join(fixturesDir, 'flags/gulpfile/cwd/gulpfile.js')
8186
);
82-
expect(stderr).toEqual('');
8387
done(err);
8488
}
8589
});

test/config-flags-silent.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ describe('config: flags.silent', function() {
1919
.run(cb);
2020

2121
function cb(err, stdout, stderr) {
22-
expect(stdout).toEqual('');
22+
expect(err).toEqual(null);
2323
expect(stderr).toEqual('');
24+
expect(stdout).toEqual('');
2425
done(err);
2526
}
2627
});
@@ -33,13 +34,14 @@ describe('config: flags.silent', function() {
3334
.run(cb);
3435

3536
function cb(err, stdout, stderr) {
37+
expect(err).toEqual(null);
38+
expect(stderr).toEqual('');
3639
stdout = eraseLapse(eraseTime(skipLines(stdout, 1)));
3740
expect(stdout).toEqual(
3841
'Starting \'default\'...\n' +
3942
'Finished \'default\' after ?\n' +
4043
''
4144
);
42-
expect(stderr).toEqual('');
4345
done(err);
4446
}
4547
});

test/exports-as-tasks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ describe('exports as tasks', function() {
1919
'--gulpfile ./test/fixtures/gulpfiles/gulpfile-exports.babel.js')
2020
.run(cb);
2121

22-
function cb(err, stdout) {
22+
function cb(err, stdout, stderr) {
2323
var filepath = path.join(expectedDir, 'tasks-as-exports.txt');
2424
var expected = fs.readFileSync(filepath, 'utf-8');
25+
expect(stderr).toEqual('');
2526
stdout = eraseTime(skipLines(stdout, 2));
2627
expect(stdout).toEqual(expected);
2728
done();

test/flags-continue.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ describe('flag: --continue', function() {
1616

1717
function cb(err, stdout, stderr) {
1818
expect(err).toNotEqual(null);
19-
2019
stdout = eraseLapse(eraseTime(skipLines(stdout, 2)));
2120
expect(stdout).toEqual(
2221
'Starting \'test4\'...\n' +
@@ -42,7 +41,6 @@ describe('flag: --continue', function() {
4241

4342
function cb(err, stdout, stderr) {
4443
expect(err).toNotEqual(null);
45-
4644
expect(stdout).toNotMatch('Starting \'anon\'');
4745
stdout = eraseLapse(eraseTime(skipLines(stdout, 2)));
4846
expect(stdout).toEqual(

test/flags-gulpfile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ describe('flag: --gulpfile', function() {
1717
.gulp('--gulpfile', gulpfilePath)
1818
.run(cb);
1919

20-
function cb(err, stdout) {
20+
function cb(err, stdout, stderr) {
21+
expect(err).toEqual(null);
22+
expect(stderr).toEqual('');
23+
2124
var chgWorkdirLog = headLines(stdout, 1);
2225
var workdir = path.dirname(gulpfilePath).replace(/\//g, path.sep);
2326
expect(chgWorkdirLog).toMatch('Working directory changed to ');

test/flags-help.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ describe('flag: --help', function() {
2121
.gulp('--help', '--cwd ./test/fixtures/gulpfiles')
2222
.run(cb);
2323

24-
function cb(err, stdout) {
24+
function cb(err, stdout, stderr) {
25+
expect(err).toEqual(null);
26+
expect(stderr).toEqual('');
2527
stdout = eraseFirstSpace(stdout);
2628
expect(stdout).toEqual(outputText);
2729
done(err);
@@ -33,7 +35,9 @@ describe('flag: --help', function() {
3335
.gulp('--h', '--cwd ./test/fixtures/gulpfiles')
3436
.run(cb);
3537

36-
function cb(err, stdout) {
38+
function cb(err, stdout, stderr) {
39+
expect(err).toEqual(null);
40+
expect(stderr).toEqual('');
3741
stdout = eraseFirstSpace(stdout);
3842
expect(stdout).toEqual(outputText);
3943
done(err);

test/flags-require.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ describe('flag: --require', function() {
1515
.gulp('--require ../test-module.js', '--cwd ./test/fixtures/gulpfiles')
1616
.run(cb);
1717

18-
function cb(err, stdout) {
18+
function cb(err, stdout, stderr) {
19+
expect(err).toEqual(null);
20+
expect(stderr).toEqual('');
1921
var insideLog = headLines(stdout, 1);
2022
expect(insideLog).toEqual('inside test module');
2123

@@ -54,6 +56,9 @@ describe('flag: --require', function() {
5456
.run(cb);
5557

5658
function cb(err, stdout, stderr) {
59+
expect(err).toEqual(null);
60+
stderr = eraseLapse(eraseTime(stderr));
61+
expect(stderr).toMatch('Failed to load external module ./null-module.js');
5762
expect(stdout).toNotMatch('inside test module');
5863
expect(stdout).toNotMatch(
5964
'Requiring external module ../test-module.js');

test/flags-silent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ describe('flag: --silent', function() {
1010
.gulp('--silent', '--cwd ./test/fixtures/gulpfiles')
1111
.run(cb);
1212

13-
function cb(err, stdout) {
13+
function cb(err, stdout, stderr) {
14+
expect(err).toEqual(null);
15+
expect(stderr).toEqual('');
1416
expect(stdout).toEqual('');
1517
done(err);
1618
}

0 commit comments

Comments
 (0)