5,158 questions with no answers
-1 votes
0 answers
22 views
TypeError: Cannot read properties of null (reading 'getConfig')
how can i resolve this problem and this my jest.config.js module.exports = { preset: 'react-native', "setupFilesAfterEnv": [ "@testing-library/jest-native/extend-expect" ]...
-1 votes
0 answers
57 views
Argument of type 'PoolConnection' is not assignable to parameter of type 'never'
I want to mock transaction as PoolConnection jest.mock('../../src/config/db.js', () => ({ __esModule: true, default: { execute: jest.fn(), query: jest.fn(), ...
1 vote
0 answers
88 views
Problem with toHaveBeenCalledWith called from window object
This is my unit test: import '@testing-library/jest-dom/extend-expect'; import { render, cleanup, fireEvent, waitFor, waitForElementToBeRemoved, screen, } from '@testing-library/svelte'; ...
0 votes
0 answers
40 views
Jest/Puppeteer test for a Chrome Extension fails with timeout on Firestore getDoc, but manual tests and Cloud Function succeed
I am building a Manifest V3 Chrome Extension using Firebase and testing it with Jest and Puppeteer. My manual testing works perfectly, but one specific automated test consistently fails with a 30-...
0 votes
0 answers
38 views
jest object in setupFilesAfterEnv differs from jest in test files
I’m trying to add a custom method onto the Jest API inside a setup file (config.ts) configured via setupFilesAfterEnv. However, the jest object I mutate in the setup file is NOT the same reference as ...
0 votes
0 answers
428 views
Mock jsdom Location using @jest/environment-jsdom-abstract
Jest 30 uses JSDOM 26, which breaks my tests. I want to test if location.search was modified. Since JSDOM 21, it is not possible to mock location.search as easily as it used to be: // does not work ...
0 votes
0 answers
85 views
Jest hangs when publishing to @google-cloud/pubsub in integration test
I have an integration test that publishes a domain event to Google Cloud Pub/Sub (using the Pub/Sub emulator). Eventduspatcher.integration.test.ts passes but Jest prints: Jest did not exit one second ...
0 votes
0 answers
197 views
Failed to parse the TypeScript config file with Jest 30.x and Node 22.18+
I'm running into some inconsistent behavior with Jest 30.x, specifically when parsing a jest.config.ts file that imports another TypeScript module, on Node.js 22.18+. My code uses ESM syntax for the ...
0 votes
0 answers
63 views
Unable to find element text from Backstage Table component in test (All components (2) not found)
I'm testing a Backstage plugin component that renders a list of Ansible components using the Backstage Table from @backstage/core-components. In my test, I mock the catalog API to return 2 entities (...
1 vote
0 answers
46 views
Is Jest cache shared with other projects on a CI server?
My question is related to Enabling Jest cache in CI servers but a bit more specific. We use Jest with cache enabled on a CI server running tests on multiple projects. By default, Jest uses /tmp/...
9 votes
0 answers
1k views
Enabling Jest cache in CI servers
As I understand Jest test execution gets faster when we run along with the cache build over the previous runs. In out project we are able to realize that benefit when we run our test in local. We are ...
0 votes
0 answers
58 views
Jest coverage shows different results when running single test file vs all tests
I'm experiencing frustrating Jest coverage inconsistencies in my React project. When I run tests for individual files in isolation, I get perfect 100% coverage as expected. However, when I run the ...
3 votes
0 answers
76 views
Jest with TypeScript weird import error: SyntaxError: Cannot use import statement outside a module
Im trying to configure an unit test for my website with Jest and I can't get it to work correctly. I've tried some of the solutions suggested by the ts-jest documentation but it still hasn't worked. ...
0 votes
0 answers
76 views
Testing functions that use the SVG API
I am beginning to add tests to my TypeScript web application using Jest. Some functions (or methods) use the SVG API and interact with the DOM. I installed: jest @types/jest jest-environment-jsdom, ...
0 votes
0 answers
47 views
Firebase/auth mock with JEST is not recognised
Im trying to test an error state which get updated when no foundEnterprise match is found: async function onSubmit (data) { try { const enterprisesData = await fetchData() const ...