brainy/archive/fix-documentation.md
David Snelling 79df44351c **chore: remove outdated changelog and summary documents**
- Deleted `CHANGES.md`, `CHANGES_SUMMARY.md`, `CONCURRENCY_ANALYSIS.md`, `CONCURRENCY_IMPLEMENTATION_SUMMARY.md`, and related developer documentation files.
- Removed redundant or legacy content no longer aligned with the current codebase and workflows.
- Updated repository to reflect streamlined documentation approach, reducing clutter and improving maintainability.

**Purpose**: Simplify and declutter repository by removing obsolete documentation files, ensuring it remains focused and relevant.
2025-07-30 11:51:39 -07:00

1.3 KiB
Raw Blame History

Fix for "process.memoryUsage is not a function" Error

Issue

During test runs with Vitest, the following error was occurring:

TypeError: process.memoryUsage is not a function
  VitestTestRunner.onAfterRunSuite node_modules/vitest/dist/runners.js:150:95

This error was happening because Vitest was trying to use process.memoryUsage() to log heap usage statistics, but this function was not available in the current environment.

Solution

The issue was fixed by disabling the heap usage logging in the Vitest configuration:

In vitest.config.ts, changed:

// Show test statistics
logHeapUsage: true,

To:

// Show test statistics
logHeapUsage: false,

Explanation

The logHeapUsage option in Vitest attempts to use Node.js's process.memoryUsage() function to track and report memory usage during test runs. However, this function might not be available in all environments, particularly in certain browser-like environments or when using specific Node.js versions or configurations.

By setting logHeapUsage: false, we prevent Vitest from attempting to call this function, which resolves the error while still allowing tests to run successfully.

Verification

After making this change, the tests run without any unhandled errors, confirming that the issue has been resolved.