-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: Put all argv into the process title for better monitoring
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
function makeTitle(cmd, argv) { | ||
if (!argv || argv.length === 0) { | ||
return cmd; | ||
} | ||
|
||
return [cmd].concat(argv).join(' '); | ||
} | ||
|
||
module.exports = makeTitle; |
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,36 @@ | ||
'use strict'; | ||
|
||
var expect = require('expect'); | ||
|
||
var makeTitle = require('../../lib/shared/make-title'); | ||
|
||
describe('lib: make-title', function() { | ||
|
||
it('returns the command if no argv passed', function(done) { | ||
var title = makeTitle('gulp'); | ||
|
||
expect(title).toEqual('gulp'); | ||
done(); | ||
}); | ||
|
||
it('returns the command if argv is 0 length', function(done) { | ||
var title = makeTitle('gulp', []); | ||
|
||
expect(title).toEqual('gulp'); | ||
done(); | ||
}); | ||
|
||
it('returns the command and argvs if not empty', function(done) { | ||
var title = makeTitle('gulp', ['build']); | ||
|
||
expect(title).toEqual('gulp build'); | ||
done(); | ||
}); | ||
|
||
it('concats all argv', function(done) { | ||
var title = makeTitle('gulp', ['build', '--prod']); | ||
|
||
expect(title).toEqual('gulp build --prod'); | ||
done(); | ||
}); | ||
}); |