// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
// SPDX-License-Identifier: GPL-3.0-or-later
-if (globalThis.Worker == null) {
+/**
+* Polyfill for window methods which do not exist when executing Node.js tests.
+*/
+if (typeof window === 'undefined' && typeof self === 'undefined') {
const { Worker } = await import('node:worker_threads')
//@ts-expect-error
Worker.prototype.addEventListener = Worker.prototype.addListener