-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add config flags.logLevel
#113
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
'use strict'; | ||
|
||
var expect = require('expect'); | ||
var path = require('path'); | ||
var eraseTime = require('gulp-test-tools').eraseTime; | ||
var runner = require('gulp-test-tools').gulpRunner; | ||
|
||
describe('config: flag.logLevel', function() { | ||
|
||
describe('log level 3 by default', function() { | ||
it('Should output error log', function(done) { | ||
runner({ verbose: false }) | ||
.gulp('--gulpfile x') | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(stdout).toEqual(''); | ||
expect(eraseTime(stderr)).toEqual('No gulpfile found\n'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output warn log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'invalid-package.json'); | ||
|
||
runner({ verbose: false }) | ||
.gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(eraseTime(stdout)).toEqual( | ||
'Verifying plugins in ' + packageJsonPath + '\n' + | ||
'Blacklisted plugins found in this project:\n' + | ||
'gulp-blink: deprecated. use \`blink` instead.\n'); | ||
expect(stderr).toEqual(''); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output info log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'valid-package.json'); | ||
|
||
runner({ verbose: false }) | ||
.gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toEqual(null); | ||
expect(eraseTime(stdout)).toEqual( | ||
'Verifying plugins in ' + packageJsonPath + '\n' + | ||
'There are no blacklisted plugins in this project\n'); | ||
expect(stderr).toEqual(''); | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('log level 1 by config `flags.logLevel`', function() { | ||
var gulp = runner({ verbose: false }) | ||
.basedir(path.join(__dirname, 'fixtures/config/flags/logLevel/L')) | ||
.gulp; | ||
|
||
it('Should output error log', function(done) { | ||
gulp('--gulpfile x') | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(stdout).toEqual(''); | ||
expect(eraseTime(stderr)).toEqual('No gulpfile found\n'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output warn log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'invalid-package.json'); | ||
|
||
gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(stdout).toEqual(''); | ||
expect(stderr).toEqual(''); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output info log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'valid-package.json'); | ||
|
||
gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toEqual(null); | ||
expect(stdout).toEqual(''); | ||
expect(stderr).toEqual(''); | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('log level 2 by config `flags.logLevel`', function() { | ||
var gulp = runner({ verbose: false }) | ||
.basedir(path.join(__dirname, 'fixtures/config/flags/logLevel/LL')) | ||
.gulp; | ||
|
||
it('Should output error log', function(done) { | ||
gulp('--gulpfile x') | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(stdout).toEqual(''); | ||
expect(eraseTime(stderr)).toEqual('No gulpfile found\n'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output warn log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'invalid-package.json'); | ||
|
||
gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(eraseTime(stdout)).toEqual( | ||
'Blacklisted plugins found in this project:\n' + | ||
'gulp-blink: deprecated. use \`blink` instead.\n'); | ||
expect(stderr).toEqual(''); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output info log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'valid-package.json'); | ||
|
||
gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toEqual(null); | ||
expect(stdout).toEqual(''); | ||
expect(stderr).toEqual(''); | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('log level 3 by config `flags.logLevel`', function() { | ||
var gulp = runner({ verbose: false }) | ||
.basedir(path.join(__dirname, 'fixtures/config/flags/logLevel/LLL')) | ||
.gulp; | ||
|
||
it('Should output error log', function(done) { | ||
gulp('--gulpfile x') | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(stdout).toEqual(''); | ||
expect(eraseTime(stderr)).toEqual('No gulpfile found\n'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output warn log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'invalid-package.json'); | ||
|
||
gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toNotEqual(null); | ||
expect(eraseTime(stdout)).toEqual( | ||
'Verifying plugins in ' + packageJsonPath + '\n' + | ||
'Blacklisted plugins found in this project:\n' + | ||
'gulp-blink: deprecated. use \`blink` instead.\n'); | ||
expect(stderr).toEqual(''); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should output info log', function(done) { | ||
var packageJsonPath = path.resolve(__dirname, 'fixtures/packages', | ||
'valid-package.json'); | ||
|
||
gulp('--verify', packageJsonPath) | ||
.run(function(err, stdout, stderr) { | ||
expect(err).toEqual(null); | ||
expect(eraseTime(stdout)).toEqual( | ||
'Verifying plugins in ' + packageJsonPath + '\n' + | ||
'There are no blacklisted plugins in this project\n'); | ||
expect(stderr).toEqual(''); | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"flags": { | ||
"logLevel": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"flags": { | ||
"logLevel": 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"flags": { | ||
"logLevel": 3 | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are we going to run into weird test runs on old node versions with this removed?
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.
@phated The reason of removing this line is that the latest npm don’t support old versions of nodejs (< v4.x). This is needed if we are going to support gulp-cli on these old versions and use Appveyor for test on Windows.
Or we might be able to skip test on Windows about old versions of nodejs.
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.
Not dropping 0.10.
Just install npm at a good version, like 2
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.
@phated If the “weird test” means using gulp-test-tool, since this tool is a thing to solve this issue on nodejs v0.10 on Windows, we can remove this tool if we skip test on Windows about old versions of nodejs.
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.
My reply crossed with yours.
I got it. I checked our test succeeded with
npm@2
now.