Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
How can I avoid app crashing because of importing jest?

I tried many ways of importing jest into my project. All of them cause my app to crash displaying the blank screen when visiting localhost:3000 even though all statements cause app to compile (the single line of import causes the app to crash):

import { mocked } from "ts-jest"

import { mocked } from '@jest/globals'

import { jest } from 'ts-jest'

import { jest } from '@jest/globals'

App crashes with the following error:

VM551:2 Uncaught ReferenceError: process is not defined

I have the following dependency in package.json:

"ts-jest": "^28.0.7"

What might be the reason behind crashing? What is the correct way to import jest? I need specifically mocked object to be available, is there a right way to make it work without crashing the app?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It sounds like you're trying to import jest or mocked into your application code that runs in the browser, which won't work. process is a global in Node, but not in the browser, which is why you're getting this error:

Uncaught ReferenceError: process is not defined

If you're trying to use mock data, you can define that data in a separate file that you can import both in your test files (which run in Node) and in your application code (which runs in the browser).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!