ipc-iterate-back-serial.js
This file
Path
test/fixtures/ipc-iterate-back-serial.js
24 lines · 752 bytes · JavaScript
Last changed by
Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
History of this fileTake it
Debounce `message` events (#1087)ehmickybefore adoptione8bab97
lines 1–4why, one step back1#!/usr/bin/env node2import process from 'node:process';3import {sendMessage, getOneMessage} from '../../index.js';4import {PARALLEL_COUNT} from '../helpers/parallel.js';Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 5why, one step back5import {isAlwaysTrue, getFirst} from '../helpers/ipc.js';Debounce `message` events (#1087)ehmickybefore adoptione8bab97
line 6why, one step back6Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 7why, one step back7const filter = process.argv[2] === 'true' ? isAlwaysTrue : undefined;Debounce `message` events (#1087)ehmickybefore adoptione8bab97
lines 8–24why, one step back89await sendMessage(await getOneMessage({filter}));1011const promise = sendMessage(1);12process.emit('message', '.');13await promise;1415const messages = Array.from({length: PARALLEL_COUNT}, (_, index) => index + 2);16for (const message of messages) {17 // eslint-disable-next-line no-await-in-loop18 await sendMessage(message);19}2021const secondPromise = process.argv[3] === 'true'22 ? getFirst()23 : getOneMessage({filter});24await sendMessage(await secondPromise);