concurrently 10.0.0 → 10.0.3
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/dist/lib/flow-control/flow-controller.d.ts +13 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -14
- package/dist/bin/index.spec.js +0 -368
- package/dist/bin/normalize-cli-command.spec.d.ts +0 -1
- package/dist/bin/normalize-cli-command.spec.js +0 -36
- package/dist/lib/__fixtures__/create-mock-instance.d.ts +0 -2
- package/dist/lib/__fixtures__/create-mock-instance.js +0 -5
- package/dist/lib/__fixtures__/fake-command.d.ts +0 -6
- package/dist/lib/__fixtures__/fake-command.js +0 -37
- package/dist/lib/assert.spec.d.ts +0 -1
- package/dist/lib/assert.spec.js +0 -41
- package/dist/lib/command-parser/expand-arguments.spec.d.ts +0 -1
- package/dist/lib/command-parser/expand-arguments.spec.js +0 -57
- package/dist/lib/command-parser/expand-shortcut.spec.d.ts +0 -1
- package/dist/lib/command-parser/expand-shortcut.spec.js +0 -36
- package/dist/lib/command-parser/expand-wildcard.spec.d.ts +0 -1
- package/dist/lib/command-parser/expand-wildcard.spec.js +0 -288
- package/dist/lib/command.spec.d.ts +0 -1
- package/dist/lib/command.spec.js +0 -369
- package/dist/lib/completion-listener.spec.d.ts +0 -1
- package/dist/lib/completion-listener.spec.js +0 -229
- package/dist/lib/concurrently.spec.d.ts +0 -1
- package/dist/lib/concurrently.spec.js +0 -320
- package/dist/lib/date-format.spec.d.ts +0 -1
- package/dist/lib/date-format.spec.js +0 -480
- package/dist/lib/flow-control/input-handler.spec.d.ts +0 -1
- package/dist/lib/flow-control/input-handler.spec.js +0 -116
- package/dist/lib/flow-control/kill-on-signal.spec.d.ts +0 -1
- package/dist/lib/flow-control/kill-on-signal.spec.js +0 -63
- package/dist/lib/flow-control/kill-others.spec.d.ts +0 -1
- package/dist/lib/flow-control/kill-others.spec.js +0 -98
- package/dist/lib/flow-control/log-error.spec.d.ts +0 -1
- package/dist/lib/flow-control/log-error.spec.js +0 -33
- package/dist/lib/flow-control/log-exit.spec.d.ts +0 -1
- package/dist/lib/flow-control/log-exit.spec.js +0 -24
- package/dist/lib/flow-control/log-output.spec.d.ts +0 -1
- package/dist/lib/flow-control/log-output.spec.js +0 -33
- package/dist/lib/flow-control/log-timings.spec.d.ts +0 -1
- package/dist/lib/flow-control/log-timings.spec.js +0 -89
- package/dist/lib/flow-control/logger-padding.spec.d.ts +0 -1
- package/dist/lib/flow-control/logger-padding.spec.js +0 -60
- package/dist/lib/flow-control/output-error-handler.spec.d.ts +0 -1
- package/dist/lib/flow-control/output-error-handler.spec.js +0 -41
- package/dist/lib/flow-control/restart-process.spec.d.ts +0 -1
- package/dist/lib/flow-control/restart-process.spec.js +0 -127
- package/dist/lib/flow-control/teardown.spec.d.ts +0 -1
- package/dist/lib/flow-control/teardown.spec.js +0 -93
- package/dist/lib/jsonc.spec.d.ts +0 -1
- package/dist/lib/jsonc.spec.js +0 -73
- package/dist/lib/logger.spec.d.ts +0 -1
- package/dist/lib/logger.spec.js +0 -507
- package/dist/lib/observables.spec.d.ts +0 -1
- package/dist/lib/observables.spec.js +0 -29
- package/dist/lib/output-writer.spec.d.ts +0 -1
- package/dist/lib/output-writer.spec.js +0 -96
- package/dist/lib/prefix-color-selector.spec.d.ts +0 -1
- package/dist/lib/prefix-color-selector.spec.js +0 -159
- package/dist/lib/spawn.spec.d.ts +0 -1
- package/dist/lib/spawn.spec.js +0 -100
- package/dist/lib/utils.spec.d.ts +0 -1
- package/dist/lib/utils.spec.js +0 -58
- /package/dist/{bin/index.spec.d.ts → lib/flow-control/flow-controller.js} +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { ExpandShortcut } from './expand-shortcut.js';
|
|
3
|
-
const parser = new ExpandShortcut();
|
|
4
|
-
const createCommandInfo = (command, name = '') => ({
|
|
5
|
-
name,
|
|
6
|
-
command,
|
|
7
|
-
});
|
|
8
|
-
it('returns same command if no prefix is present', () => {
|
|
9
|
-
const commandInfo = createCommandInfo('echo foo');
|
|
10
|
-
expect(parser.parse(commandInfo)).toBe(commandInfo);
|
|
11
|
-
});
|
|
12
|
-
describe.each([
|
|
13
|
-
['npm', 'npm run'],
|
|
14
|
-
['yarn', 'yarn run'],
|
|
15
|
-
['pnpm', 'pnpm run'],
|
|
16
|
-
['bun', 'bun run'],
|
|
17
|
-
['node', 'node --run'],
|
|
18
|
-
['deno', 'deno task'],
|
|
19
|
-
])(`with '%s:' prefix`, (prefix, command) => {
|
|
20
|
-
it(`expands to "${command} <script> <args>"`, () => {
|
|
21
|
-
const commandInfo = createCommandInfo(`${prefix}:foo -- bar`, 'echo');
|
|
22
|
-
expect(parser.parse(commandInfo)).toEqual({
|
|
23
|
-
...commandInfo,
|
|
24
|
-
name: 'echo',
|
|
25
|
-
command: `${command} foo -- bar`,
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
it('sets name to script name if none', () => {
|
|
29
|
-
const commandInfo = createCommandInfo(`${prefix}:foo -- bar`);
|
|
30
|
-
expect(parser.parse(commandInfo)).toEqual({
|
|
31
|
-
...commandInfo,
|
|
32
|
-
name: 'foo',
|
|
33
|
-
command: `${command} foo -- bar`,
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import { ExpandWildcard } from './expand-wildcard.js';
|
|
4
|
-
let parser;
|
|
5
|
-
let readPackage;
|
|
6
|
-
let readDeno;
|
|
7
|
-
const createCommandInfo = (command) => ({
|
|
8
|
-
command,
|
|
9
|
-
name: '',
|
|
10
|
-
});
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
readDeno = vi.fn();
|
|
13
|
-
readPackage = vi.fn();
|
|
14
|
-
parser = new ExpandWildcard(readDeno, readPackage);
|
|
15
|
-
});
|
|
16
|
-
afterEach(() => {
|
|
17
|
-
vi.restoreAllMocks();
|
|
18
|
-
});
|
|
19
|
-
describe('#readDeno()', () => {
|
|
20
|
-
it('can read deno.json', () => {
|
|
21
|
-
const expectedDeno = {
|
|
22
|
-
name: 'deno',
|
|
23
|
-
version: '1.14.0',
|
|
24
|
-
};
|
|
25
|
-
vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
|
|
26
|
-
return path === 'deno.json';
|
|
27
|
-
});
|
|
28
|
-
vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
|
|
29
|
-
if (path === 'deno.json') {
|
|
30
|
-
return JSON.stringify(expectedDeno);
|
|
31
|
-
}
|
|
32
|
-
return '';
|
|
33
|
-
});
|
|
34
|
-
const actualReadDeno = ExpandWildcard.readDeno();
|
|
35
|
-
expect(actualReadDeno).toEqual(expectedDeno);
|
|
36
|
-
});
|
|
37
|
-
it('can read deno.jsonc', () => {
|
|
38
|
-
const expectedDeno = {
|
|
39
|
-
name: 'deno',
|
|
40
|
-
version: '1.14.0',
|
|
41
|
-
};
|
|
42
|
-
vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
|
|
43
|
-
return path === 'deno.jsonc';
|
|
44
|
-
});
|
|
45
|
-
vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
|
|
46
|
-
if (path === 'deno.jsonc') {
|
|
47
|
-
return `/* comment */\n${JSON.stringify(expectedDeno)}`;
|
|
48
|
-
}
|
|
49
|
-
return '';
|
|
50
|
-
});
|
|
51
|
-
const actualReadDeno = ExpandWildcard.readDeno();
|
|
52
|
-
expect(actualReadDeno).toEqual(expectedDeno);
|
|
53
|
-
});
|
|
54
|
-
it('prefers deno.json over deno.jsonc', () => {
|
|
55
|
-
const expectedDeno = {
|
|
56
|
-
name: 'deno',
|
|
57
|
-
version: '1.14.0',
|
|
58
|
-
};
|
|
59
|
-
vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
|
|
60
|
-
return path === 'deno.json' || path === 'deno.jsonc';
|
|
61
|
-
});
|
|
62
|
-
vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
|
|
63
|
-
if (path === 'deno.json') {
|
|
64
|
-
return JSON.stringify(expectedDeno);
|
|
65
|
-
}
|
|
66
|
-
return '';
|
|
67
|
-
});
|
|
68
|
-
const actualReadDeno = ExpandWildcard.readDeno();
|
|
69
|
-
expect(actualReadDeno).toEqual(expectedDeno);
|
|
70
|
-
});
|
|
71
|
-
it('can handle errors reading deno', () => {
|
|
72
|
-
vi.spyOn(fs, 'existsSync').mockReturnValue(true);
|
|
73
|
-
vi.spyOn(fs, 'readFileSync').mockImplementation(() => {
|
|
74
|
-
throw new Error('Error reading deno');
|
|
75
|
-
});
|
|
76
|
-
expect(() => ExpandWildcard.readDeno()).not.toThrow();
|
|
77
|
-
expect(ExpandWildcard.readDeno()).toEqual({});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('#readPackage()', () => {
|
|
81
|
-
it('can read package', () => {
|
|
82
|
-
const expectedPackage = {
|
|
83
|
-
name: 'concurrently',
|
|
84
|
-
version: '6.4.0',
|
|
85
|
-
};
|
|
86
|
-
vi.spyOn(fs, 'readFileSync').mockImplementation((path) => {
|
|
87
|
-
if (path === 'package.json') {
|
|
88
|
-
return JSON.stringify(expectedPackage);
|
|
89
|
-
}
|
|
90
|
-
return '';
|
|
91
|
-
});
|
|
92
|
-
const actualReadPackage = ExpandWildcard.readPackage();
|
|
93
|
-
expect(actualReadPackage).toEqual(expectedPackage);
|
|
94
|
-
});
|
|
95
|
-
it('can handle errors reading package', () => {
|
|
96
|
-
vi.spyOn(fs, 'readFileSync').mockImplementation(() => {
|
|
97
|
-
throw new Error('Error reading package');
|
|
98
|
-
});
|
|
99
|
-
expect(() => ExpandWildcard.readPackage()).not.toThrow();
|
|
100
|
-
expect(ExpandWildcard.readPackage()).toEqual({});
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
it('returns same command if not an npm run command', () => {
|
|
104
|
-
const commandInfo = createCommandInfo('npm test');
|
|
105
|
-
expect(readDeno).not.toHaveBeenCalled();
|
|
106
|
-
expect(readPackage).not.toHaveBeenCalled();
|
|
107
|
-
expect(parser.parse(commandInfo)).toBe(commandInfo);
|
|
108
|
-
});
|
|
109
|
-
it('returns same command if not a deno task command', () => {
|
|
110
|
-
const commandInfo = createCommandInfo('deno run');
|
|
111
|
-
expect(readDeno).not.toHaveBeenCalled();
|
|
112
|
-
expect(readPackage).not.toHaveBeenCalled();
|
|
113
|
-
expect(parser.parse(commandInfo)).toBe(commandInfo);
|
|
114
|
-
});
|
|
115
|
-
it('returns same command if no wildcard present', () => {
|
|
116
|
-
const commandInfo = createCommandInfo('npm run foo bar');
|
|
117
|
-
expect(readPackage).not.toHaveBeenCalled();
|
|
118
|
-
expect(parser.parse(commandInfo)).toBe(commandInfo);
|
|
119
|
-
});
|
|
120
|
-
it('expands to nothing if no scripts exist in package.json', () => {
|
|
121
|
-
readPackage.mockReturnValue({});
|
|
122
|
-
expect(parser.parse(createCommandInfo('npm run foo-*-baz qux'))).toEqual([]);
|
|
123
|
-
});
|
|
124
|
-
it('expands to nothing if no tasks exist in Deno config and no scripts exist in NodeJS config', () => {
|
|
125
|
-
readDeno.mockReturnValue({});
|
|
126
|
-
readPackage.mockReturnValue({});
|
|
127
|
-
expect(parser.parse(createCommandInfo('deno task foo-*-baz qux'))).toEqual([]);
|
|
128
|
-
});
|
|
129
|
-
describe.each(['npm run', 'yarn run', 'pnpm run', 'bun run', 'node --run'])(`with a '%s' prefix`, (command) => {
|
|
130
|
-
it('expands to all scripts matching pattern', () => {
|
|
131
|
-
readPackage.mockReturnValue({
|
|
132
|
-
scripts: {
|
|
133
|
-
'foo-bar-baz': '',
|
|
134
|
-
'foo--baz': '',
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
expect(parser.parse(createCommandInfo(`${command} foo-*-baz qux`))).toEqual([
|
|
138
|
-
{ name: 'bar', command: `${command} foo-bar-baz qux` },
|
|
139
|
-
{ name: '', command: `${command} foo--baz qux` },
|
|
140
|
-
]);
|
|
141
|
-
});
|
|
142
|
-
it('uses wildcard match of script as command name', () => {
|
|
143
|
-
readPackage.mockReturnValue({
|
|
144
|
-
scripts: {
|
|
145
|
-
'watch-js': '',
|
|
146
|
-
'watch-css': '',
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
expect(parser.parse({
|
|
150
|
-
name: 'watch-*',
|
|
151
|
-
command: `${command} watch-*`,
|
|
152
|
-
})).toEqual([
|
|
153
|
-
{ name: 'js', command: `${command} watch-js` },
|
|
154
|
-
{ name: 'css', command: `${command} watch-css` },
|
|
155
|
-
]);
|
|
156
|
-
});
|
|
157
|
-
it('uses existing command name as prefix to the wildcard match', () => {
|
|
158
|
-
readPackage.mockReturnValue({
|
|
159
|
-
scripts: {
|
|
160
|
-
'watch-js': '',
|
|
161
|
-
'watch-css': '',
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
expect(parser.parse({
|
|
165
|
-
name: 'w:',
|
|
166
|
-
command: `${command} watch-*`,
|
|
167
|
-
})).toEqual([
|
|
168
|
-
{ name: 'w:js', command: `${command} watch-js` },
|
|
169
|
-
{ name: 'w:css', command: `${command} watch-css` },
|
|
170
|
-
]);
|
|
171
|
-
});
|
|
172
|
-
it('allows negation', () => {
|
|
173
|
-
readPackage.mockReturnValue({
|
|
174
|
-
scripts: {
|
|
175
|
-
'lint:js': '',
|
|
176
|
-
'lint:ts': '',
|
|
177
|
-
'lint:fix:js': '',
|
|
178
|
-
'lint:fix:ts': '',
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
expect(parser.parse(createCommandInfo(`${command} lint:*(!fix)`))).toEqual([
|
|
182
|
-
{ name: 'js', command: `${command} lint:js` },
|
|
183
|
-
{ name: 'ts', command: `${command} lint:ts` },
|
|
184
|
-
]);
|
|
185
|
-
});
|
|
186
|
-
it('caches scripts upon calls', () => {
|
|
187
|
-
readPackage.mockReturnValue({});
|
|
188
|
-
parser.parse(createCommandInfo(`${command} foo-*-baz qux`));
|
|
189
|
-
parser.parse(createCommandInfo(`${command} foo-*-baz qux`));
|
|
190
|
-
expect(readPackage).toHaveBeenCalledTimes(1);
|
|
191
|
-
});
|
|
192
|
-
it("doesn't read Deno config", () => {
|
|
193
|
-
readPackage.mockReturnValue({});
|
|
194
|
-
parser.parse(createCommandInfo(`${command} foo-*-baz qux`));
|
|
195
|
-
expect(readDeno).not.toHaveBeenCalled();
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
describe(`with a 'deno task' prefix`, () => {
|
|
199
|
-
it('expands to all scripts matching pattern', () => {
|
|
200
|
-
readDeno.mockReturnValue({
|
|
201
|
-
tasks: {
|
|
202
|
-
'foo-bar-baz': '',
|
|
203
|
-
'foo--baz': '',
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
readPackage.mockReturnValue({
|
|
207
|
-
scripts: {
|
|
208
|
-
'foo-foo-baz': '',
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
expect(parser.parse(createCommandInfo(`deno task foo-*-baz qux`))).toEqual([
|
|
212
|
-
{ name: 'bar', command: `deno task foo-bar-baz qux` },
|
|
213
|
-
{ name: '', command: `deno task foo--baz qux` },
|
|
214
|
-
{ name: 'foo', command: `deno task foo-foo-baz qux` },
|
|
215
|
-
]);
|
|
216
|
-
});
|
|
217
|
-
it('uses wildcard match of script as command name', () => {
|
|
218
|
-
readDeno.mockReturnValue({
|
|
219
|
-
tasks: {
|
|
220
|
-
'watch-sass': '',
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
readPackage.mockReturnValue({
|
|
224
|
-
scripts: {
|
|
225
|
-
'watch-js': '',
|
|
226
|
-
'watch-css': '',
|
|
227
|
-
},
|
|
228
|
-
});
|
|
229
|
-
expect(parser.parse({
|
|
230
|
-
name: '',
|
|
231
|
-
command: `deno task watch-*`,
|
|
232
|
-
})).toEqual([
|
|
233
|
-
{ name: 'sass', command: `deno task watch-sass` },
|
|
234
|
-
{ name: 'js', command: `deno task watch-js` },
|
|
235
|
-
{ name: 'css', command: `deno task watch-css` },
|
|
236
|
-
]);
|
|
237
|
-
});
|
|
238
|
-
it('uses existing command name as prefix to the wildcard match', () => {
|
|
239
|
-
readDeno.mockReturnValue({
|
|
240
|
-
tasks: {
|
|
241
|
-
'watch-sass': '',
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
readPackage.mockReturnValue({
|
|
245
|
-
scripts: {
|
|
246
|
-
'watch-js': '',
|
|
247
|
-
'watch-css': '',
|
|
248
|
-
},
|
|
249
|
-
});
|
|
250
|
-
expect(parser.parse({
|
|
251
|
-
name: 'w:',
|
|
252
|
-
command: `deno task watch-*`,
|
|
253
|
-
})).toEqual([
|
|
254
|
-
{ name: 'w:sass', command: `deno task watch-sass` },
|
|
255
|
-
{ name: 'w:js', command: `deno task watch-js` },
|
|
256
|
-
{ name: 'w:css', command: `deno task watch-css` },
|
|
257
|
-
]);
|
|
258
|
-
});
|
|
259
|
-
it('allows negation', () => {
|
|
260
|
-
readDeno.mockReturnValue({
|
|
261
|
-
tasks: {
|
|
262
|
-
'lint:sass': '',
|
|
263
|
-
'lint:fix:sass': '',
|
|
264
|
-
},
|
|
265
|
-
});
|
|
266
|
-
readPackage.mockReturnValue({
|
|
267
|
-
scripts: {
|
|
268
|
-
'lint:js': '',
|
|
269
|
-
'lint:ts': '',
|
|
270
|
-
'lint:fix:js': '',
|
|
271
|
-
'lint:fix:ts': '',
|
|
272
|
-
},
|
|
273
|
-
});
|
|
274
|
-
expect(parser.parse(createCommandInfo(`deno task lint:*(!fix)`))).toEqual([
|
|
275
|
-
{ name: 'sass', command: `deno task lint:sass` },
|
|
276
|
-
{ name: 'js', command: `deno task lint:js` },
|
|
277
|
-
{ name: 'ts', command: `deno task lint:ts` },
|
|
278
|
-
]);
|
|
279
|
-
});
|
|
280
|
-
it('caches scripts upon calls', () => {
|
|
281
|
-
readDeno.mockReturnValue({});
|
|
282
|
-
readPackage.mockReturnValue({});
|
|
283
|
-
parser.parse(createCommandInfo(`deno task foo-*-baz qux`));
|
|
284
|
-
parser.parse(createCommandInfo(`deno task foo-*-baz qux`));
|
|
285
|
-
expect(readDeno).toHaveBeenCalledTimes(1);
|
|
286
|
-
expect(readPackage).toHaveBeenCalledTimes(1);
|
|
287
|
-
});
|
|
288
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|