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,320 +0,0 @@
|
|
|
1
|
-
import os from 'node:os';
|
|
2
|
-
import { Writable } from 'node:stream';
|
|
3
|
-
import { beforeEach, expect, it, vi } from 'vitest';
|
|
4
|
-
import { createMockInstance } from './__fixtures__/create-mock-instance.js';
|
|
5
|
-
import { createFakeProcess, FakeCommand } from './__fixtures__/fake-command.js';
|
|
6
|
-
import { concurrently } from './concurrently.js';
|
|
7
|
-
import { Logger } from './logger.js';
|
|
8
|
-
let spawn;
|
|
9
|
-
let kill;
|
|
10
|
-
let onFinishHooks;
|
|
11
|
-
let controllers;
|
|
12
|
-
let processes;
|
|
13
|
-
const create = (commands, options = {}) => concurrently(commands, Object.assign(options, { controllers, spawn, kill }));
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
vi.resetAllMocks();
|
|
16
|
-
processes = [];
|
|
17
|
-
spawn = vi.fn(() => {
|
|
18
|
-
const process = createFakeProcess(processes.length);
|
|
19
|
-
processes.push(process);
|
|
20
|
-
return process;
|
|
21
|
-
});
|
|
22
|
-
kill = vi.fn();
|
|
23
|
-
onFinishHooks = [vi.fn(), vi.fn()];
|
|
24
|
-
controllers = [
|
|
25
|
-
{ handle: vi.fn((commands) => ({ commands, onFinish: onFinishHooks[0] })) },
|
|
26
|
-
{ handle: vi.fn((commands) => ({ commands, onFinish: onFinishHooks[1] })) },
|
|
27
|
-
];
|
|
28
|
-
});
|
|
29
|
-
it('fails if commands is not an array', () => {
|
|
30
|
-
const bomb = () => create('foo');
|
|
31
|
-
expect(bomb).toThrow();
|
|
32
|
-
});
|
|
33
|
-
it('fails if no commands were provided', () => {
|
|
34
|
-
const bomb = () => create([]);
|
|
35
|
-
expect(bomb).toThrow();
|
|
36
|
-
});
|
|
37
|
-
it('spawns all commands', () => {
|
|
38
|
-
create(['echo', 'kill']);
|
|
39
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
40
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({}));
|
|
41
|
-
expect(spawn).toHaveBeenCalledWith('kill', expect.objectContaining({}));
|
|
42
|
-
});
|
|
43
|
-
it('log output is passed to output stream if logger is specified in options', () => {
|
|
44
|
-
const logger = new Logger({ hide: [] });
|
|
45
|
-
const outputStream = createMockInstance(Writable);
|
|
46
|
-
create(['foo'], { logger, outputStream });
|
|
47
|
-
logger.log('foo', 'bar');
|
|
48
|
-
expect(outputStream.write).toHaveBeenCalledTimes(2);
|
|
49
|
-
expect(outputStream.write).toHaveBeenCalledWith('foo');
|
|
50
|
-
expect(outputStream.write).toHaveBeenCalledWith('bar');
|
|
51
|
-
});
|
|
52
|
-
it('log output is not passed to output stream after it has errored', () => {
|
|
53
|
-
const logger = new Logger({ hide: [] });
|
|
54
|
-
const outputStream = new Writable();
|
|
55
|
-
vi.spyOn(outputStream, 'write');
|
|
56
|
-
create(['foo'], { logger, outputStream });
|
|
57
|
-
outputStream.emit('error', new Error('test'));
|
|
58
|
-
logger.log('foo', 'bar');
|
|
59
|
-
expect(outputStream.write).not.toHaveBeenCalled();
|
|
60
|
-
});
|
|
61
|
-
it('spawns commands up to configured limit at once', () => {
|
|
62
|
-
create(['foo', 'bar', 'baz', 'qux'], { maxProcesses: 2 });
|
|
63
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
64
|
-
expect(spawn).toHaveBeenCalledWith('foo', expect.objectContaining({}));
|
|
65
|
-
expect(spawn).toHaveBeenCalledWith('bar', expect.objectContaining({}));
|
|
66
|
-
// Test out of order completion picking up new processes in-order
|
|
67
|
-
processes[1].emit('close', 1, null);
|
|
68
|
-
expect(spawn).toHaveBeenCalledTimes(3);
|
|
69
|
-
expect(spawn).toHaveBeenCalledWith('baz', expect.objectContaining({}));
|
|
70
|
-
processes[0].emit('close', null, 'SIGINT');
|
|
71
|
-
expect(spawn).toHaveBeenCalledTimes(4);
|
|
72
|
-
expect(spawn).toHaveBeenCalledWith('qux', expect.objectContaining({}));
|
|
73
|
-
// Shouldn't attempt to spawn anything else.
|
|
74
|
-
processes[2].emit('close', 1, null);
|
|
75
|
-
expect(spawn).toHaveBeenCalledTimes(4);
|
|
76
|
-
});
|
|
77
|
-
it('spawns commands up to percent based limit at once', () => {
|
|
78
|
-
// Mock architecture with 4 cores
|
|
79
|
-
const cpusSpy = vi.spyOn(os, 'cpus');
|
|
80
|
-
cpusSpy.mockReturnValue(Array.from({ length: 4 }).fill({
|
|
81
|
-
model: 'Intel',
|
|
82
|
-
speed: 0,
|
|
83
|
-
times: { user: 0, nice: 0, sys: 0, idle: 0, irq: 0 },
|
|
84
|
-
}));
|
|
85
|
-
create(['foo', 'bar', 'baz', 'qux'], { maxProcesses: '50%' });
|
|
86
|
-
// Max parallel processes should be 2 (50% of 4 cores)
|
|
87
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
88
|
-
expect(spawn).toHaveBeenCalledWith('foo', expect.objectContaining({}));
|
|
89
|
-
expect(spawn).toHaveBeenCalledWith('bar', expect.objectContaining({}));
|
|
90
|
-
// Close first process and expect third to be spawned
|
|
91
|
-
processes[0].emit('close', 1, null);
|
|
92
|
-
expect(spawn).toHaveBeenCalledTimes(3);
|
|
93
|
-
expect(spawn).toHaveBeenCalledWith('baz', expect.objectContaining({}));
|
|
94
|
-
// Close second process and expect fourth to be spawned
|
|
95
|
-
processes[1].emit('close', 1, null);
|
|
96
|
-
expect(spawn).toHaveBeenCalledTimes(4);
|
|
97
|
-
expect(spawn).toHaveBeenCalledWith('qux', expect.objectContaining({}));
|
|
98
|
-
});
|
|
99
|
-
it('does not spawn further commands on abort signal aborted', () => {
|
|
100
|
-
const abortController = new AbortController();
|
|
101
|
-
create(['foo', 'bar'], { maxProcesses: 1, abortSignal: abortController.signal });
|
|
102
|
-
expect(spawn).toHaveBeenCalledTimes(1);
|
|
103
|
-
abortController.abort();
|
|
104
|
-
processes[0].emit('close', 0, null);
|
|
105
|
-
expect(spawn).toHaveBeenCalledTimes(1);
|
|
106
|
-
});
|
|
107
|
-
it('preserves quotes in well-formed shell commands in the library API', () => {
|
|
108
|
-
create(['"/usr/local/bin/mytool" --flag "some value"']);
|
|
109
|
-
controllers.forEach((controller) => {
|
|
110
|
-
expect(controller.handle).toHaveBeenCalledWith([
|
|
111
|
-
expect.objectContaining({
|
|
112
|
-
command: '"/usr/local/bin/mytool" --flag "some value"',
|
|
113
|
-
index: 0,
|
|
114
|
-
}),
|
|
115
|
-
]);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
it('passes commands with multiple quote sets through unchanged in the library API', () => {
|
|
119
|
-
create(['"/usr/local/bin/mytool" --flag "some value" --other "last arg"']);
|
|
120
|
-
controllers.forEach((controller) => {
|
|
121
|
-
expect(controller.handle).toHaveBeenCalledWith([
|
|
122
|
-
expect.objectContaining({
|
|
123
|
-
command: '"/usr/local/bin/mytool" --flag "some value" --other "last arg"',
|
|
124
|
-
index: 0,
|
|
125
|
-
}),
|
|
126
|
-
]);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
it('runs commands with a name or prefix color', () => {
|
|
130
|
-
create([{ command: 'echo', prefixColor: 'red', name: 'foo' }, 'kill']);
|
|
131
|
-
controllers.forEach((controller) => {
|
|
132
|
-
expect(controller.handle).toHaveBeenCalledWith([
|
|
133
|
-
expect.objectContaining({ command: 'echo', index: 0, name: 'foo', prefixColor: 'red' }),
|
|
134
|
-
expect.objectContaining({ command: 'kill', index: 1, name: '', prefixColor: '' }),
|
|
135
|
-
]);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
it('runs commands with a list of colors', () => {
|
|
139
|
-
create(['echo', 'kill'], {
|
|
140
|
-
prefixColors: ['red'],
|
|
141
|
-
});
|
|
142
|
-
controllers.forEach((controller) => {
|
|
143
|
-
expect(controller.handle).toHaveBeenCalledWith([
|
|
144
|
-
expect.objectContaining({ command: 'echo', prefixColor: 'red' }),
|
|
145
|
-
expect.objectContaining({ command: 'kill', prefixColor: 'red' }),
|
|
146
|
-
]);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
it('passes commands wrapped from a controller to the next one', () => {
|
|
150
|
-
const fakeCommand = new FakeCommand('banana', 'banana');
|
|
151
|
-
controllers[0].handle.mockReturnValue({ commands: [fakeCommand] });
|
|
152
|
-
create(['echo']);
|
|
153
|
-
expect(controllers[0].handle).toHaveBeenCalledWith([
|
|
154
|
-
expect.objectContaining({ command: 'echo', index: 0 }),
|
|
155
|
-
]);
|
|
156
|
-
expect(controllers[1].handle).toHaveBeenCalledWith([fakeCommand]);
|
|
157
|
-
expect(fakeCommand.start).toHaveBeenCalledTimes(1);
|
|
158
|
-
});
|
|
159
|
-
it('merges extra env vars into each command', () => {
|
|
160
|
-
create([
|
|
161
|
-
{ command: 'echo', env: { foo: 'bar' } },
|
|
162
|
-
{ command: 'echo', env: { foo: 'baz' } },
|
|
163
|
-
'kill',
|
|
164
|
-
]);
|
|
165
|
-
expect(spawn).toHaveBeenCalledTimes(3);
|
|
166
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
167
|
-
env: expect.objectContaining({ foo: 'bar' }),
|
|
168
|
-
}));
|
|
169
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
170
|
-
env: expect.objectContaining({ foo: 'baz' }),
|
|
171
|
-
}));
|
|
172
|
-
expect(spawn).toHaveBeenCalledWith('kill', expect.objectContaining({
|
|
173
|
-
env: expect.not.objectContaining({ foo: expect.anything() }),
|
|
174
|
-
}));
|
|
175
|
-
});
|
|
176
|
-
it('uses cwd from options for each command', () => {
|
|
177
|
-
create([
|
|
178
|
-
{ command: 'echo', env: { foo: 'bar' } },
|
|
179
|
-
{ command: 'echo', env: { foo: 'baz' } },
|
|
180
|
-
'kill',
|
|
181
|
-
], {
|
|
182
|
-
cwd: 'foobar',
|
|
183
|
-
});
|
|
184
|
-
expect(spawn).toHaveBeenCalledTimes(3);
|
|
185
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
186
|
-
env: expect.objectContaining({ foo: 'bar' }),
|
|
187
|
-
cwd: 'foobar',
|
|
188
|
-
}));
|
|
189
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
190
|
-
env: expect.objectContaining({ foo: 'baz' }),
|
|
191
|
-
cwd: 'foobar',
|
|
192
|
-
}));
|
|
193
|
-
expect(spawn).toHaveBeenCalledWith('kill', expect.objectContaining({
|
|
194
|
-
env: expect.not.objectContaining({ foo: expect.anything() }),
|
|
195
|
-
cwd: 'foobar',
|
|
196
|
-
}));
|
|
197
|
-
});
|
|
198
|
-
it('uses overridden cwd option for each command if specified', () => {
|
|
199
|
-
create([
|
|
200
|
-
{ command: 'echo', env: { foo: 'bar' }, cwd: 'baz' },
|
|
201
|
-
{ command: 'echo', env: { foo: 'baz' } },
|
|
202
|
-
], {
|
|
203
|
-
cwd: 'foobar',
|
|
204
|
-
});
|
|
205
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
206
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
207
|
-
env: expect.objectContaining({ foo: 'bar' }),
|
|
208
|
-
cwd: 'baz',
|
|
209
|
-
}));
|
|
210
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
211
|
-
env: expect.objectContaining({ foo: 'baz' }),
|
|
212
|
-
cwd: 'foobar',
|
|
213
|
-
}));
|
|
214
|
-
});
|
|
215
|
-
it('uses raw from options for each command', () => {
|
|
216
|
-
create([{ command: 'echo' }, 'kill'], {
|
|
217
|
-
raw: true,
|
|
218
|
-
});
|
|
219
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
220
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
221
|
-
stdio: ['inherit', 'inherit', 'inherit'],
|
|
222
|
-
}));
|
|
223
|
-
expect(spawn).toHaveBeenCalledWith('kill', expect.objectContaining({
|
|
224
|
-
stdio: ['inherit', 'inherit', 'inherit'],
|
|
225
|
-
}));
|
|
226
|
-
});
|
|
227
|
-
it('uses overridden raw option for each command if specified', () => {
|
|
228
|
-
create([{ command: 'echo', raw: false }, { command: 'echo' }], {
|
|
229
|
-
raw: true,
|
|
230
|
-
});
|
|
231
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
232
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
233
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
234
|
-
}));
|
|
235
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
236
|
-
stdio: ['inherit', 'inherit', 'inherit'],
|
|
237
|
-
}));
|
|
238
|
-
});
|
|
239
|
-
it('uses hide from options for each command', () => {
|
|
240
|
-
create([{ command: 'echo' }, 'kill'], {
|
|
241
|
-
hide: [1],
|
|
242
|
-
});
|
|
243
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
244
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
245
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
246
|
-
}));
|
|
247
|
-
expect(spawn).toHaveBeenCalledWith('kill', expect.objectContaining({
|
|
248
|
-
stdio: ['pipe', 'ignore', 'ignore'],
|
|
249
|
-
}));
|
|
250
|
-
});
|
|
251
|
-
it('hides output for commands even if raw option is on', () => {
|
|
252
|
-
create([{ command: 'echo' }, 'kill'], {
|
|
253
|
-
hide: [1],
|
|
254
|
-
raw: true,
|
|
255
|
-
});
|
|
256
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
257
|
-
expect(spawn).toHaveBeenCalledWith('echo', expect.objectContaining({
|
|
258
|
-
stdio: ['inherit', 'inherit', 'inherit'],
|
|
259
|
-
}));
|
|
260
|
-
expect(spawn).toHaveBeenCalledWith('kill', expect.objectContaining({
|
|
261
|
-
stdio: ['pipe', 'ignore', 'ignore'],
|
|
262
|
-
}));
|
|
263
|
-
});
|
|
264
|
-
it('argument placeholders are properly replaced when additional arguments are passed', () => {
|
|
265
|
-
create([
|
|
266
|
-
{ command: 'echo {1}' },
|
|
267
|
-
{ command: 'echo {@}' },
|
|
268
|
-
{ command: 'echo {*}' },
|
|
269
|
-
{ command: 'echo \\{@}' },
|
|
270
|
-
], {
|
|
271
|
-
additionalArguments: ['foo', 'bar'],
|
|
272
|
-
});
|
|
273
|
-
expect(spawn).toHaveBeenCalledTimes(4);
|
|
274
|
-
expect(spawn).toHaveBeenCalledWith('echo foo', expect.objectContaining({}));
|
|
275
|
-
expect(spawn).toHaveBeenCalledWith('echo foo bar', expect.objectContaining({}));
|
|
276
|
-
expect(spawn).toHaveBeenCalledWith("echo 'foo bar'", expect.objectContaining({}));
|
|
277
|
-
expect(spawn).toHaveBeenCalledWith('echo {@}', expect.objectContaining({}));
|
|
278
|
-
});
|
|
279
|
-
it('argument placeholders are not replaced when additional arguments are not defined', () => {
|
|
280
|
-
create([
|
|
281
|
-
{ command: 'echo {1}' },
|
|
282
|
-
{ command: 'echo {@}' },
|
|
283
|
-
{ command: 'echo {*}' },
|
|
284
|
-
{ command: 'echo \\{@}' },
|
|
285
|
-
]);
|
|
286
|
-
expect(spawn).toHaveBeenCalledTimes(4);
|
|
287
|
-
expect(spawn).toHaveBeenCalledWith('echo {1}', expect.objectContaining({}));
|
|
288
|
-
expect(spawn).toHaveBeenCalledWith('echo {@}', expect.objectContaining({}));
|
|
289
|
-
expect(spawn).toHaveBeenCalledWith('echo {*}', expect.objectContaining({}));
|
|
290
|
-
expect(spawn).toHaveBeenCalledWith('echo {@}', expect.objectContaining({}));
|
|
291
|
-
});
|
|
292
|
-
it('runs onFinish hook after all commands run', async () => {
|
|
293
|
-
const promise = create(['foo', 'bar'], { maxProcesses: 1 });
|
|
294
|
-
expect(spawn).toHaveBeenCalledTimes(1);
|
|
295
|
-
expect(onFinishHooks[0]).not.toHaveBeenCalled();
|
|
296
|
-
expect(onFinishHooks[1]).not.toHaveBeenCalled();
|
|
297
|
-
processes[0].emit('close', 0, null);
|
|
298
|
-
expect(spawn).toHaveBeenCalledTimes(2);
|
|
299
|
-
expect(onFinishHooks[0]).not.toHaveBeenCalled();
|
|
300
|
-
expect(onFinishHooks[1]).not.toHaveBeenCalled();
|
|
301
|
-
processes[1].emit('close', 0, null);
|
|
302
|
-
await promise.result;
|
|
303
|
-
expect(onFinishHooks[0]).toHaveBeenCalled();
|
|
304
|
-
expect(onFinishHooks[1]).toHaveBeenCalled();
|
|
305
|
-
});
|
|
306
|
-
// This test should time out if broken
|
|
307
|
-
it('waits for onFinish hooks to complete before resolving', async () => {
|
|
308
|
-
onFinishHooks[0].mockResolvedValue(undefined);
|
|
309
|
-
const { result } = create(['foo', 'bar']);
|
|
310
|
-
processes[0].emit('close', 0, null);
|
|
311
|
-
processes[1].emit('close', 0, null);
|
|
312
|
-
await expect(result).resolves.toBeDefined();
|
|
313
|
-
});
|
|
314
|
-
it('rejects if onFinish hooks reject', async () => {
|
|
315
|
-
onFinishHooks[0].mockRejectedValue('error');
|
|
316
|
-
const { result } = create(['foo', 'bar']);
|
|
317
|
-
processes[0].emit('close', 0, null);
|
|
318
|
-
processes[1].emit('close', 0, null);
|
|
319
|
-
await expect(result).rejects.toBe('error');
|
|
320
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|