Skip to content

Commit

Permalink
Fix tests for prefix usage
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavohenke committed Jul 24, 2018
1 parent c8bbe55 commit 7ee0da2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/test-functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@ describe('concurrently', function() {

it('--prefix can contain PID', () => {
const collectedLines = [];
return run('node ./src/main.js --prefix {pid} "echo one" "echo two"', {
return run('node ./src/main.js --prefix pid "echo one" "echo two"', {
onOutputLine(line) {
collectedLines.push(line);
}
}).then(() => {
assert.ok(/^\d+ one$/.test(collectedLines[0]));
assert.ok(/^\d+ two$/.test(collectedLines[1]));
assert.ok(collectedLines.every(line => /^\[\d+\] /.test(line)));
});
});

Expand All @@ -136,20 +135,18 @@ describe('concurrently', function() {
collectedLines.push(line);
}
}).then(() => {
assert.equal(collectedLines[0], '[echo one] one');
assert.equal(collectedLines[1], '[echo two] two');
assert.ok(collectedLines.every(line => /^\[echo (one|two)\] /.test(line)));
});
});

it('--prefix can contain time', () => {
const collectedLines = [];
return run('node ./src/main.js --prefix {time} "echo one" "echo two"', {
return run('node ./src/main.js --prefix time "echo one" "echo two"', {
onOutputLine(line) {
collectedLines.push(line);
}
}).then(() => {
assert.ok(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} one$/.test(collectedLines[0]));
assert.ok(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} two$/.test(collectedLines[1]));
assert.ok(collectedLines.every(line => /^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\] /.test(line)));
});
});

Expand Down

0 comments on commit 7ee0da2

Please sign in to comment.