Skip to main content

All Questions

1 vote
0 answers
68 views

Test suite failed to run ReferenceError: TextEncoder is not defined

I am trying to test my project using a mock API instead of a real one to save money. However, when I add the following code to my setupTests.js file: // setupTests.js import { server } from "./...
Ali Asghar Gill's user avatar
1 vote
1 answer
70 views

How to unit test logic under AG GRID gridApi function forEachNode

Trying to get my unit test coverage for this bit of code: processUpdates(input) { let request = []; this.gridApi.forEachNode(function (node) { // <--- How to mock/spy inside forEachNode ...
null-point-exceptional's user avatar
-1 votes
1 answer
14 views

Can't spyOn second & third call jest

I can't do spyOn on the second and third calls of a function in a test with jest I tried to do it like this by following the documentation : it("should succeed after retry on first attempt ...
Gabriel's user avatar
  • 21
0 votes
0 answers
27 views

How can I create a unit test for a memory dump without mocking?

In Javascript, I have these two functions: const promiseMemoryDump = async (address1, address2, outputFile) => { if (getPlatform() === 'linux') { await promiseExec(`memdump -s ${address1} -...
KeeperOfTheSevenKeys's user avatar
1 vote
1 answer
92 views

speedup Nestjs + jest test performance

I wrote about 2,000 testcase in nestjs application with jest. but it takes around 3 minutes to take overall test. I want to reduce the time executing these tests. when i examine the situation, jest ...
Cain김보성's user avatar
1 vote
0 answers
32 views

getting some issue when I apply npm run test

I'm runnig npm test on my proyect, next js and I'm getting this issue: > npm test > [email protected] test > jest FAIL __tests__/pages/Home.test.tsx ● Test suite failed to run Jest ...
alex 's user avatar
  • 289
0 votes
0 answers
100 views

Nx doesn't find generated files in tree using a plugin generator while testing

I'm working in a Nx workspace, trying to create some generators. It works fine until I try to test them. The test update the tree and create all the files but fails trying to find tsconfig.json which ...
Jorge Castillo's user avatar
1 vote
0 answers
33 views

Cant change the value, it stucks with 1 as default, why?

I'm new in react and doing testing, I need to do an unit test that should fail but is working, type should be empty when brandId is 2, but is the same as you run it with 1, that returns model. brandId ...
PabloEmilio's user avatar
0 votes
0 answers
281 views

Jest failed because spyOn is still apply

I have a nodejs under nestjs App, i have some testing on Pipe. I follow this type of architecture https://github.com/mguay22/nestjs-mongo/tree/unit-testing/src/users. My test works correctly when i ...
Raphael Rlt's user avatar
0 votes
0 answers
36 views

How to test console command with mocked functions

I'm trying to make tests for my console script. # src/functions.ts const fn1 = () => console.log('fn1'); const fn2 = () => console.log('fn2'); const fnErr = () => console.log('fnErr'); # ...
Dmitry's user avatar
  • 560
0 votes
1 answer
96 views

Custom snapshot serialiser

I'm literally trying 1:1 the test that is in Jest docs for customising the snapshot serialiser: https://jestjs.io/docs/configuration#snapshotserializers-arraystring module.exports = { serialize(val, ...
alfredopacino's user avatar
0 votes
0 answers
135 views

Jest SpyOn returning undefined

I'm trying to write a jest unit test using react-testing-library and jest without the use of enzyme as from research that I've done it appears that enzyme will not be supported by react 18. Therefore ...
Olivia Bates's user avatar
0 votes
1 answer
413 views

Issue in creaating react jest test case when using chart.js

I have below test case. Please dont read entire code. (Its not necessary). what i am trying to say i wrote atleast 100times, checked with chatgpt, google bard still not able to make this test case ...
rashmi's user avatar
  • 228
0 votes
1 answer
467 views

Jest mock DeviceEventEmitter from react-native

I am trying to mock DeviceEventEmitter from react-native using jest. The actual code adds and removes a listener on component mount and unmount respectively. I have tried a lot of solutions but none ...
Joshua's user avatar
  • 1,343
1 vote
0 answers
444 views

TypeError: Cannot read properties of undefined (reading 'extend') in jest

I am using node version: v20.3.1 and jest version: 29.7.0, while running test cases getting typeError and i dont know how to solve it jest.config.js module.exports = { roots: ["<rootDir>/...
Mohammad Sohail's user avatar

15 30 50 per page
1
2 3 4 5
30