concurrently 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "concurrently",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Run commands concurrently",
5
5
  "main": "src/main.js",
6
6
  "bin": {
package/src/main.js CHANGED
@@ -472,7 +472,7 @@ function colorText(text, color) {
472
472
 
473
473
  function getPrefix(childrenInfo, child) {
474
474
  const prefixes = getPrefixes(childrenInfo, child);
475
- const prefixType = config.prefix || prefixes.name ? 'name' : 'index';
475
+ const prefixType = config.prefix || (prefixes.name ? 'name' : 'index');
476
476
  if (_.includes(_.keys(prefixes), prefixType)) {
477
477
  return '[' + prefixes[prefixType] + '] ';
478
478
  }
@@ -117,6 +117,39 @@ describe('concurrently', function() {
117
117
  });
118
118
  });
119
119
 
120
+ it('--prefix can contain PID', () => {
121
+ const collectedLines = [];
122
+ return run('node ./src/main.js --prefix pid "echo one" "echo two"', {
123
+ onOutputLine(line) {
124
+ collectedLines.push(line);
125
+ }
126
+ }).then(() => {
127
+ assert.ok(collectedLines.every(line => /^\[\d+\] /.test(line)));
128
+ });
129
+ });
130
+
131
+ it('--prefix can contain command itself', () => {
132
+ const collectedLines = [];
133
+ return run('node ./src/main.js --prefix "[{command}]" "echo one" "echo two"', {
134
+ onOutputLine(line) {
135
+ collectedLines.push(line);
136
+ }
137
+ }).then(() => {
138
+ assert.ok(collectedLines.every(line => /^\[echo (one|two)\] /.test(line)));
139
+ });
140
+ });
141
+
142
+ it('--prefix can contain time', () => {
143
+ const collectedLines = [];
144
+ return run('node ./src/main.js --prefix time "echo one" "echo two"', {
145
+ onOutputLine(line) {
146
+ collectedLines.push(line);
147
+ }
148
+ }).then(() => {
149
+ assert.ok(collectedLines.every(line => /^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\] /.test(line)));
150
+ });
151
+ });
152
+
120
153
  it('--prefix should default to "index"', () => {
121
154
  const collectedLines = [];
122
155