Movatterモバイル変換


[0]ホーム

URL:


Sorry, we no longer support your browser
Please upgrade toMicrosoft Edge,Google Chrome, orFirefox. Learn more about ourbrowser support.
Skip to main content
Stack Overflow
  1. About
  2. For Teams
Loading…
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives
22,963 questions
Filter by
Sorted by
Tagged with
0votes
0answers
21views

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 ...
htho's user avatar
  • 1,847
-1votes
0answers
39views

SyntaxError: Unexpected token 'export' in Jest for react-redux/toolkit [closed]

I got this error while testing my Header component which uses the react-redux:SyntaxError: Unexpected token 'export' 3 | import { BrowserRouter } from "react-router-dom"; 4 | ...
0votes
0answers
50views

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 ...
-2votes
0answers
44views

Unable to find text in custom modal using MUI Dialog [closed]

I'm writing a test for a React component that shows an error modal when a fetch fails. The component internally uses a custom modal that wraps @mui/material/Dialog. Here's a simplified version of my ...
0votes
0answers
81views

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 ...
1vote
0answers
33views

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/...
charlockfreefr's user avatar
0votes
0answers
47views

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 (...
1vote
1answer
48views

How to mock an imported hashPassword function in Jest when testing a registerUser method?

QuestionI have a registerUser method that imports a hashPassword function from a local utility module.// registerUser.tsimport { User } from "../models/user.model";import { hashPassword }...
0votes
2answers
84views

Nextjs with Jest - unexpected token export

I have a Next.js project with TypeScript.It's a page router instead of an app routerNo babel config file(.babelrc etc) in the projectThe error occurs when I run npm test. jost seems to be one of ...
-1votes
0answers
71views

How to make Jest depend on other test?

In PHPUnit, there is Test dependencies feature but in Jest I don't see any like that.I have tests just like this. (The whole Node.js project is in "type": "module".)import fs ...
0votes
0answers
36views

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 ...
Ndx's user avatar
  • 647
0votes
1answer
68views

Selector excluding nested values

nodejs: 24.7jsdom: 26.1.0Basically, I want to create a selector, that would exclude nested elements - it should find only elements at the first level of nesting. I have this:it('Test selector non-...
3votes
0answers
63views

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. ...
0votes
1answer
75views

testing an useState change inside a callback

I have a component like this to test:import {doSomethingMocked} form 'mockedLibrary';const TheComponent = (props) => { const [isToTest, setIsToTest] = useState(false); const handleClick = ...
-3votes
1answer
69views

jest expect(1).toEqual(2) passes while it obviously should fail the test [closed]

Can you help me explain why this jest test case passes?import { describe, it, expect } from '@jest/globals';... describe('jest assertions', () => { it('2 should not equal 1', () => { ...
Jan Dolejsi's user avatar

153050per page
1
2345
1531

Hot Network Questions

more hot questions
Newest jestjs questions feed

[8]ページ先頭

©2009-2025 Movatter.jp