-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
Expecting an object to be undefined causes a memory leak that results in the test executing infinitely until the heap runs out of memory. This happens regardless of whether expect(object).toBeUndefined() or expect(object).toBe(undefined) is called.
Reproduction
Job results: https://github.com/MolSnoo/Alter-Ego/actions/runs/20444377929/job/58744499257 (This happens on the machines of all users running this locally as well)
The test itself is actually incorrect here, as the function does return a value, but that shouldn't cause a memory leak.
EDIT: Upon further inspection, I suspect it has to do with pretty-format attempting to display circular references, as RoomItem contains a reference to Game, which itself contains references to RoomItems, and so on. This has been mended in newer commits to make game a private field accessible with a getter, but I imagine pretty-format being unable to display circular references without looping infinitely will be a problem for others.
System Info
System:
OS: Linux 6.17 Fedora Linux 43 (KDE Plasma Desktop Edition)
CPU: (12) x64 AMD Ryzen 5 7600X3D 6-Core Processor
Memory: 17.63 GB / 30.43 GB
Container: Yes
Shell: 5.3.0 - /bin/bash
Binaries:
Node: 22.20.0 - /usr/bin/node
npm: 10.9.3 - /usr/bin/npm
Browsers:
Firefox: 146.0
Firefox Developer Edition: 146.0
npmPackages:
@vitest/coverage-v8: 4.0.15 => 4.0.16
vitest: 4.0.15 => 4.0.16Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.