Skip to content

Commit

Permalink
fix: check for process env 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Schilling authored and lojjic committed Oct 19, 2020
1 parent b19cd3a commit 4f7f8f2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/troika-worker-utils/src/supportsWorkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}]`
)
}
}
}

Expand Down

0 comments on commit 4f7f8f2

Please sign in to comment.