Skip to content

test: add unit tests for performanceTracker.js#6459

Closed
eyeaadil wants to merge 1 commit intosugarlabs:masterfrom
eyeaadil:performanceTracker-unit-tests
Closed

test: add unit tests for performanceTracker.js#6459
eyeaadil wants to merge 1 commit intosugarlabs:masterfrom
eyeaadil:performanceTracker-unit-tests

Conversation

@eyeaadil
Copy link
Copy Markdown
Contributor

@eyeaadil eyeaadil commented Mar 31, 2026

Description

This PR addresses issue #6458 by adding a comprehensive Jest test suite for js/utils/performanceTracker.js.

The new test file (js/utils/tests/performanceTracker.test.js) includes 32 tests covering:

  • Toggling the enabled/disabled state
  • No-op behavior when the tracker is disabled
  • Timing functions (startRun, endRun, getStats, reset)
  • Depth tracking (enterBlock, exitBlock) including edge cases
  • Memory tracking fallback behavior
  • Console output logging logic

Test Coverage Improvement

  • Statements: 0% ➔ 88.37%
  • Functions: 0% ➔ 95%
  • Lines: 0% ➔ 87.65%
  • Tests

Related Issue

Fixes #6458

@github-actions
Copy link
Copy Markdown
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions github-actions Bot added tests Adds or updates test coverage size/L Large: 250-499 lines changed area/javascript Changes to JS source files area/tests Changes to test files labels Mar 31, 2026
@eyeaadil
Copy link
Copy Markdown
Contributor Author

@walterbender If time permits you, Can You please review this PR

Copy link
Copy Markdown
Contributor

@mahesh-09-12 mahesh-09-12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eyeaadil the test additions look good and improve coverage
the failing check seems to be from npm audit (path-to-regexp, picomatch, yaml). I’m noticing similar failures in other PRs as well, so this might be coming from upstream dependencies rather than this PR.

@omsuneri , is this something we should treat as a repo-level issue, or is it expected for contributors to handle within their PRs?

mahesh-09-12

This comment was marked as outdated.

@mahesh-09-12
Copy link
Copy Markdown
Contributor

This duplicates the existing PR (#6284) for performanceTracker.js tests and doesn't introduce any meaningful differences.
Suggest closing this to avoid duplication.

Copy link
Copy Markdown
Contributor

@mahesh-09-12 mahesh-09-12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating review based on duplicate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/javascript Changes to JS source files area/tests Changes to test files size/L Large: 250-499 lines changed tests Adds or updates test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test] Add unit tests for js/utils/performanceTracker.js

3 participants