From 4f7f8f24a9d4f4b655b61e1e16e19061c1911b02 Mon Sep 17 00:00:00 2001 From: Albert Schilling Date: Mon, 19 Oct 2020 15:14:24 +0000 Subject: [PATCH] fix: check for process env 'test' --- packages/troika-worker-utils/src/supportsWorkers.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/troika-worker-utils/src/supportsWorkers.js b/packages/troika-worker-utils/src/supportsWorkers.js index 9a1518f2..65fe14f2 100644 --- a/packages/troika-worker-utils/src/supportsWorkers.js +++ b/packages/troika-worker-utils/src/supportsWorkers.js @@ -8,14 +8,16 @@ let supportsWorkers = () => { // TODO additional checks for things like importScripts within the worker? // Would need to be an async check. let worker = new Worker( - URL.createObjectURL( - new Blob([''], { type: 'application/javascript' }) - ) + URL.createObjectURL(new Blob([''], { type: 'application/javascript' })) ) worker.terminate() supported = true } catch (err) { - console.log(`Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: [${err.message}]`) + if (process.env.NODE_ENV !== 'test') { + console.log( + `Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: [${err.message}]` + ) + } } }