mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
* test(worker): refactor worker tests + constify variables + typing + untangle web worker from worker_threads tests + cleanup variables namespace no functional changes on tests Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: move worker_threads related code to node/worker_threads Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: move worker tests into workers directory Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * refactor: report upstream changes Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * refactor: report upstream change Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * fix: address review comments Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * chore: fix submodule --------- Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> Co-authored-by: dave caruso <me@paperdave.net>
12 lines
263 B
TypeScript
12 lines
263 B
TypeScript
import { parentPort, threadId } from "worker_threads";
|
|
|
|
if (parentPort === null) {
|
|
throw new Error("parentPort is null");
|
|
}
|
|
|
|
parentPort.on("message", message => {
|
|
if (message.workerId !== threadId) {
|
|
throw new Error("threadId is not consistent");
|
|
}
|
|
});
|