mirror of
https://github.com/SrIzan10/nodemon.git
synced 2026-05-01 10:55:09 +00:00
fix: {{filename}} is only replaced once
This commit is contained in:
@@ -33,7 +33,7 @@ function execFromPackage() {
|
||||
}
|
||||
|
||||
function replace(map, str) {
|
||||
var re = new RegExp('{{(' + Object.keys(map).join('|') + ')}}');
|
||||
var re = new RegExp('{{(' + Object.keys(map).join('|') + ')}}', 'g');
|
||||
return str.replace(re, function (all, m) {
|
||||
return map[m] || all || '';
|
||||
});
|
||||
|
||||
@@ -51,6 +51,12 @@ describe('nodemon CLI parser', function () {
|
||||
assert(cmd === 'node test/fixtures/app.js.tmp --somethingElse', cmd);
|
||||
});
|
||||
|
||||
it('should replace {{filename}} multiple times', function () {
|
||||
var settings = parse(asCLI('test/fixtures/app.js --exec "node {{filename}}.tmp {{filename}}.tmp" --somethingElse'));
|
||||
var cmd = commandToString(command(settings));
|
||||
assert(cmd === 'node test/fixtures/app.js.tmp test/fixtures/app.js.tmp --somethingElse', cmd);
|
||||
});
|
||||
|
||||
it('should parse the help examples #1', function () {
|
||||
var settings = parse(asCLI('test/fixtures/app.js')),
|
||||
cmd = commandToString(command(settings));
|
||||
|
||||
Reference in New Issue
Block a user