-
-
Notifications
You must be signed in to change notification settings - Fork 112
Build: make sure to test all callback args #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,9 @@ describe('flag: --completion', function() { | |
| .gulp('--completion=' + type) | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toNotExist(); | ||
| expect(stderr).toEqual(''); | ||
| expect(stdout).toEqual(expected); | ||
| done(err); | ||
| } | ||
|
|
@@ -31,8 +33,9 @@ describe('flag: --completion', function() { | |
| .gulp('--completion=unknown') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| expect(err).toExist(); | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toNotEqual(null); | ||
| expect(stderr).toEqual(''); | ||
| expect(stdout).toEqual(expected); | ||
| done(); | ||
| } | ||
|
|
@@ -44,7 +47,9 @@ describe('flag: --completion', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(err).toNotEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toMatch('Missing completion type'); | ||
| expect(stdout).toEqual(''); | ||
| done(); | ||
| } | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,9 @@ describe('config: description', function() { | |
| .gulp('--tasks') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| var expected = fs.readFileSync(path.join(expectedDir, 'output0.txt'), | ||
| 'utf-8'); | ||
| stdout = eraseTime(stdout); | ||
|
|
@@ -36,7 +38,9 @@ describe('config: description', function() { | |
| .gulp('--tasks') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| var expected = fs.readFileSync(path.join(expectedDir, 'output0.txt'), | ||
| 'utf-8'); | ||
| stdout = eraseTime(skipLines(stdout, 1)); | ||
|
|
@@ -52,7 +56,9 @@ describe('config: description', function() { | |
| .gulp('--tasks', '--gulpfile ../foo/bar/gulpfile.js', '--cwd .') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| var expected = fs.readFileSync(path.join(expectedDir, 'output1.txt'), | ||
| 'utf-8'); | ||
| stdout = eraseTime(stdout); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,14 +17,15 @@ describe('config: flags.gulpfile', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = headLines(stdout, 2, 2); | ||
| expect(stdout).toEqual( | ||
| 'This gulpfile : ' + | ||
| path.join(fixturesDir, 'flags/gulpfile/is/here/mygulpfile.js') + | ||
| '\n' + | ||
| 'The current directory : ' + path.join(fixturesDir, 'flags/gulpfile') | ||
| ); | ||
| expect(stderr).toEqual(''); | ||
| done(err); | ||
| } | ||
| }); | ||
|
|
@@ -36,14 +37,15 @@ describe('config: flags.gulpfile', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = headLines(stdout, 2, 3); | ||
| expect(stdout).toEqual( | ||
| 'This gulpfile : ' + | ||
| path.join(fixturesDir, 'flags/gulpfile/is/here/mygulpfile.js') + | ||
| '\n' + | ||
| 'The current directory : ' + path.join(fixturesDir, 'flags/gulpfile') | ||
| ); | ||
| expect(stderr).toEqual(''); | ||
| done(err); | ||
| } | ||
| }); | ||
|
|
@@ -56,12 +58,13 @@ describe('config: flags.gulpfile', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = headLines(stdout, 1, 3); | ||
| expect(stdout).toEqual( | ||
| 'Another gulpfile : ' + | ||
| path.join(fixturesDir, 'flags/gulpfile/cwd/gulpfile.js') | ||
| ); | ||
| expect(stderr).toEqual(''); | ||
| done(err); | ||
| } | ||
| }); | ||
|
|
@@ -74,12 +77,13 @@ describe('config: flags.gulpfile', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = headLines(stdout, 1, 3); | ||
| expect(stdout).toEqual( | ||
| 'Another gulpfile : ' + | ||
| path.join(fixturesDir, 'flags/gulpfile/cwd/gulpfile.js') | ||
| ); | ||
| expect(stderr).toEqual(''); | ||
| done(err); | ||
| } | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,8 +19,9 @@ describe('config: flags.silent', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(stdout).toEqual(''); | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| expect(stdout).toEqual(''); | ||
| done(err); | ||
| } | ||
| }); | ||
|
|
@@ -33,13 +34,14 @@ describe('config: flags.silent', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = eraseLapse(eraseTime(skipLines(stdout, 1))); | ||
| expect(stdout).toEqual( | ||
| 'Starting \'default\'...\n' + | ||
| 'Finished \'default\' after ?\n' + | ||
| '' | ||
| ); | ||
| expect(stderr).toEqual(''); | ||
| done(err); | ||
| } | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,9 +19,10 @@ describe('exports as tasks', function() { | |
| '--gulpfile ./test/fixtures/gulpfiles/gulpfile-exports.babel.js') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| var filepath = path.join(expectedDir, 'tasks-as-exports.txt'); | ||
| var expected = fs.readFileSync(filepath, 'utf-8'); | ||
| expect(stderr).toEqual(''); | ||
| stdout = eraseTime(skipLines(stdout, 2)); | ||
| expect(stdout).toEqual(expected); | ||
| done(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,10 @@ describe('flag: --gulpfile', function() { | |
| .gulp('--gulpfile', gulpfilePath) | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
|
|
||
| var chgWorkdirLog = headLines(stdout, 1); | ||
| var workdir = path.dirname(gulpfilePath).replace(/\//g, path.sep); | ||
| expect(chgWorkdirLog).toMatch('Working directory changed to '); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,9 @@ describe('flag: --help', function() { | |
| .gulp('--help', '--cwd ./test/fixtures/gulpfiles') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = eraseFirstSpace(stdout); | ||
| expect(stdout).toEqual(outputText); | ||
| done(err); | ||
|
|
@@ -33,7 +35,9 @@ describe('flag: --help', function() { | |
| .gulp('--h', '--cwd ./test/fixtures/gulpfiles') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = eraseFirstSpace(stdout); | ||
| expect(stdout).toEqual(outputText); | ||
| done(err); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,9 @@ describe('flag: --require', function() { | |
| .gulp('--require ../test-module.js', '--cwd ./test/fixtures/gulpfiles') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| var insideLog = headLines(stdout, 1); | ||
| expect(insideLog).toEqual('inside test module'); | ||
|
|
||
|
|
@@ -54,6 +56,9 @@ describe('flag: --require', function() { | |
| .run(cb); | ||
|
|
||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| stderr = eraseLapse(eraseTime(stderr)); | ||
| expect(stderr).toMatch('Failed to load external module ./null-module.js'); | ||
| expect(stdout).toNotMatch('inside test module'); | ||
| expect(stdout).toNotMatch( | ||
| 'Requiring external module ../test-module.js'); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,9 @@ describe('flag: --silent', function() { | |
| .gulp('--silent', '--cwd ./test/fixtures/gulpfiles') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| expect(stdout).toEqual(''); | ||
| done(err); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,9 @@ describe('flag: --tasks-json', function() { | |
| .gulp('--tasks-json --gulpfile ./test/fixtures/gulpfiles/gulpfile.js') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = skipLines(stdout, 1); | ||
| expect(JSON.parse(stdout)).toEqual(expected); | ||
| done(); | ||
|
|
@@ -33,7 +35,11 @@ describe('flag: --tasks-json', function() { | |
| '--gulpfile ./test/fixtures/gulpfiles/gulpfile.js') | ||
| .run(cb); | ||
|
|
||
| function cb(err) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = skipLines(stdout, 1); | ||
| expect(stdout).toEqual(''); | ||
| var file = fs.readFileSync(__dirname + '/output/tasks.json', 'utf8'); | ||
| var parsedJson = JSON.parse(file); | ||
| expect(parsedJson).toEqual(expected); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,9 @@ describe('flag: --tasks-simple', function() { | |
| .gulp('--tasks-simple', '--cwd ./test/fixtures/gulpfiles') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| expect(stdout).toEqual(outputText); | ||
| done(err); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,9 @@ describe('flag: --tasks', function() { | |
| .gulp('--tasks --cwd ./test/fixtures/gulpfiles') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| var filepath = path.join(expectedDir, 'flags-tasks.txt'); | ||
| var expected = fs.readFileSync(filepath, 'utf-8'); | ||
| stdout = eraseTime(skipLines(stdout, 1)); | ||
|
|
@@ -32,7 +34,9 @@ describe('flag: --tasks', function() { | |
| '--cwd ./test/fixtures') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| var filepath = path.join(expectedDir, 'with-desc-and-flags.txt'); | ||
| var expected = fs.readFileSync(filepath, 'utf-8'); | ||
| stdout = eraseTime(skipLines(stdout, 1)); | ||
|
|
@@ -49,7 +53,9 @@ describe('flag: --tasks', function() { | |
| '--cwd ./test/fixtures') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| var filepath = path.join(expectedDir, 'by-unwrap-and-not-by-unwrap.txt'); | ||
| var expected = fs.readFileSync(filepath, 'utf-8'); | ||
| stdout = eraseTime(skipLines(stdout, 1)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,9 +12,9 @@ describe('flag: --verify', function() { | |
| .gulp('--verify invalid-package.json', '--cwd ./test/fixtures/packages/') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toNotEqual(null); | ||
|
|
||
| expect(stderr).toEqual(''); | ||
| stdout = eraseTime(stdout); | ||
| expect(stdout).toEqual( | ||
| 'Verifying plugins in ' + | ||
|
|
@@ -33,7 +33,9 @@ describe('flag: --verify', function() { | |
| .gulp('--verify valid-package.json', '--cwd ./test/fixtures/packages/') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toEqual(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer |
||
| expect(stderr).toEqual(''); | ||
| stdout = eraseTime(stdout); | ||
| expect(stdout).toEqual( | ||
| 'Verifying plugins in ' + | ||
|
|
@@ -51,9 +53,9 @@ describe('flag: --verify', function() { | |
| .gulp('--verify', '--cwd ./test/fixtures/packages/') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
| expect(err).toNotEqual(null); | ||
|
|
||
| expect(stderr).toEqual(''); | ||
| stdout = eraseTime(stdout); | ||
| expect(stdout).toEqual( | ||
| 'Verifying plugins in ' + | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,8 @@ describe('flag: --version', function() { | |
| .gulp('--version --cwd ./test/fixtures/gulpfiles') | ||
| .run(cb); | ||
|
|
||
| function cb(err, stdout) { | ||
| function cb(err, stdout, stderr) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| expect(stderr).toEqual(''); | ||
| stdout = eraseTime(stdout); | ||
| expect(stdout).toEqual( | ||
| 'CLI version ' + cliVersion + '\n' + | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer
toExist, why did you change totoNotEqual(null)?