testdouble / testdouble/testdouble.js

testdouble experiencing memory issue when running 800 unit tests

Open
#534 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.4k
Forks
140
Avg merge
22h
Merged PRs (30d)
1

Description

Description

Running 800 unit tests using testdouble, resulting in memory leak.

Issue

There are many testdouble usages that do not seem to be deleting properly. Therefore, when building on Jenkins, it terminates with the error message:
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

This image comes from a Heap Snapshot of some of the tests.

Screenshot 2024-08-29 at 3 34 13 PM

Our currently code consists of the following, but it doesn't seem to help resolve the memory leak.
afterEach(function () { td.reset(); });

Are there any other lines that should be included to help with garbage collection?

Environment
  • node -v output: 18.20.4
  • npm -v (or yarn --version) output: 10.7.0
  • npm ls testdouble (or yarn list testdouble) version: 3.20.2
Failing Test
  • Fork the repo
  • Add a failing test (probably to the `/regression/src' directory)
  • Submit a pull request for the failing test or link to your branch here
Example Repo
  • Create a minimal repository that reproduces the issue
  • Make sure that a fresh clone can run only npm it and observe the issue
  • Link to that repo here
Runkit Notebook
  • Create a Runkit notebook
  • Invoke var td = require('testdouble') at the top
  • Verify the behavior your issue is concerned with by clicking "Run"
  • Link to the Runkit here
Code-fenced Examples
var td = require('testdouble')

// Your steps here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the memory growth with the reported 800-test Jenkins scenario using testdouble 3.20.2, then inspect the regression/src directory for a focused failing test. Run npm it after adding a minimal reproduction; done means the retained testdouble usage is reproducible and the cleanup behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.