Skip to content

Commit 50260b3

Browse files
fix: do not overload system when a hook is async (#40)
1 parent bb14c18 commit 50260b3

5 files changed

Lines changed: 475 additions & 11 deletions

File tree

__tests__/__snapshots__/index.test.js.snap

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,261 @@ Array [
326326

327327
exports[`execa-webpack-plugin should work and output 'stdout' and 'stderr' (sync hook): warnings 1`] = `Array []`;
328328

329+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 1) (async hook): errors 1`] = `Array []`;
330+
331+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 1) (async hook): logs 1`] = `
332+
Array [
333+
Array [
334+
"ExecaPlugin",
335+
"log",
336+
Array [
337+
"Running the \\"done\\" hook",
338+
],
339+
],
340+
Array [
341+
"ExecaPlugin",
342+
"log",
343+
Array [
344+
"Run command \\"node /__tests__/resources/nothing.js\\"",
345+
],
346+
],
347+
Array [
348+
"ExecaPlugin",
349+
"log",
350+
Array [
351+
"Run command \\"node /__tests__/resources/nothing.js\\"",
352+
],
353+
],
354+
Array [
355+
"ExecaPlugin",
356+
"log",
357+
Array [
358+
"Run command \\"node /__tests__/resources/nothing.js\\"",
359+
],
360+
],
361+
Array [
362+
"ExecaPlugin",
363+
"log",
364+
Array [
365+
"Run command \\"node /__tests__/resources/nothing.js\\"",
366+
],
367+
],
368+
Array [
369+
"ExecaPlugin",
370+
"log",
371+
Array [
372+
"The \\"done\\" hook completed",
373+
],
374+
],
375+
]
376+
`;
377+
378+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 1) (async hook): warnings 1`] = `Array []`;
379+
380+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 2) (async hook): errors 1`] = `Array []`;
381+
382+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 2) (async hook): logs 1`] = `
383+
Array [
384+
Array [
385+
"ExecaPlugin",
386+
"log",
387+
Array [
388+
"Running the \\"done\\" hook",
389+
],
390+
],
391+
Array [
392+
"ExecaPlugin",
393+
"log",
394+
Array [
395+
"Run command \\"node /__tests__/resources/nothing.js\\"",
396+
],
397+
],
398+
Array [
399+
"ExecaPlugin",
400+
"log",
401+
Array [
402+
"Run command \\"node /__tests__/resources/nothing.js\\"",
403+
],
404+
],
405+
Array [
406+
"ExecaPlugin",
407+
"log",
408+
Array [
409+
"Run command \\"node /__tests__/resources/nothing.js\\"",
410+
],
411+
],
412+
Array [
413+
"ExecaPlugin",
414+
"log",
415+
Array [
416+
"Run command \\"node /__tests__/resources/nothing.js\\"",
417+
],
418+
],
419+
Array [
420+
"ExecaPlugin",
421+
"log",
422+
Array [
423+
"The \\"done\\" hook completed",
424+
],
425+
],
426+
]
427+
`;
428+
429+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 2) (async hook): warnings 1`] = `Array []`;
430+
431+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 4) (async hook): errors 1`] = `Array []`;
432+
433+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 4) (async hook): logs 1`] = `
434+
Array [
435+
Array [
436+
"ExecaPlugin",
437+
"log",
438+
Array [
439+
"Running the \\"done\\" hook",
440+
],
441+
],
442+
Array [
443+
"ExecaPlugin",
444+
"log",
445+
Array [
446+
"Run command \\"node /__tests__/resources/nothing.js\\"",
447+
],
448+
],
449+
Array [
450+
"ExecaPlugin",
451+
"log",
452+
Array [
453+
"Run command \\"node /__tests__/resources/nothing.js\\"",
454+
],
455+
],
456+
Array [
457+
"ExecaPlugin",
458+
"log",
459+
Array [
460+
"Run command \\"node /__tests__/resources/nothing.js\\"",
461+
],
462+
],
463+
Array [
464+
"ExecaPlugin",
465+
"log",
466+
Array [
467+
"Run command \\"node /__tests__/resources/nothing.js\\"",
468+
],
469+
],
470+
Array [
471+
"ExecaPlugin",
472+
"log",
473+
Array [
474+
"The \\"done\\" hook completed",
475+
],
476+
],
477+
]
478+
`;
479+
480+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 4) (async hook): warnings 1`] = `Array []`;
481+
482+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 4) (sync hook): errors 1`] = `Array []`;
483+
484+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 4) (sync hook): logs 1`] = `
485+
Array [
486+
Array [
487+
"ExecaPlugin",
488+
"log",
489+
Array [
490+
"Running the \\"compile\\" hook",
491+
],
492+
],
493+
Array [
494+
"ExecaPlugin",
495+
"log",
496+
Array [
497+
"Run command \\"node /__tests__/resources/nothing.js\\"",
498+
],
499+
],
500+
Array [
501+
"ExecaPlugin",
502+
"log",
503+
Array [
504+
"Run command \\"node /__tests__/resources/nothing.js\\"",
505+
],
506+
],
507+
Array [
508+
"ExecaPlugin",
509+
"log",
510+
Array [
511+
"Run command \\"node /__tests__/resources/nothing.js\\"",
512+
],
513+
],
514+
Array [
515+
"ExecaPlugin",
516+
"log",
517+
Array [
518+
"Run command \\"node /__tests__/resources/nothing.js\\"",
519+
],
520+
],
521+
Array [
522+
"ExecaPlugin",
523+
"log",
524+
Array [
525+
"The \\"compile\\" hook completed",
526+
],
527+
],
528+
]
529+
`;
530+
531+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 4) (sync hook): warnings 1`] = `Array []`;
532+
533+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 16) (async hook): errors 1`] = `Array []`;
534+
535+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 16) (async hook): logs 1`] = `
536+
Array [
537+
Array [
538+
"ExecaPlugin",
539+
"log",
540+
Array [
541+
"Running the \\"done\\" hook",
542+
],
543+
],
544+
Array [
545+
"ExecaPlugin",
546+
"log",
547+
Array [
548+
"Run command \\"node /__tests__/resources/nothing.js\\"",
549+
],
550+
],
551+
Array [
552+
"ExecaPlugin",
553+
"log",
554+
Array [
555+
"Run command \\"node /__tests__/resources/nothing.js\\"",
556+
],
557+
],
558+
Array [
559+
"ExecaPlugin",
560+
"log",
561+
Array [
562+
"Run command \\"node /__tests__/resources/nothing.js\\"",
563+
],
564+
],
565+
Array [
566+
"ExecaPlugin",
567+
"log",
568+
Array [
569+
"Run command \\"node /__tests__/resources/nothing.js\\"",
570+
],
571+
],
572+
Array [
573+
"ExecaPlugin",
574+
"log",
575+
Array [
576+
"The \\"done\\" hook completed",
577+
],
578+
],
579+
]
580+
`;
581+
582+
exports[`execa-webpack-plugin should work multiple commands and do not overload the system (the number of cores is 16) (async hook): warnings 1`] = `Array []`;
583+
329584
exports[`execa-webpack-plugin should work when nested commands return nothing and 'bail: false' (async hook): errors 1`] = `Array []`;
330585

331586
exports[`execa-webpack-plugin should work when nested commands return nothing and 'bail: false' (async hook): logs 1`] = `

0 commit comments

Comments
 (0)