Skip to content

Commit

Permalink
fix: check if process is undefined
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 4f7f8f2 commit 2b6d56a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/troika-worker-utils/src/supportsWorkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ let supportsWorkers = () => {
worker.terminate()
supported = true
} catch (err) {
if (process.env.NODE_ENV !== 'test') {
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'test') {
// No console log for node env 'test' (e.g. tests with Jest)
} else {
console.log(
`Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: [${err.message}]`
)
Expand Down

0 comments on commit 2b6d56a

Please sign in to comment.