Skip to content

Fix module export for reflection.js to enable proper Jest coverage re…#5940

Open
stutijain2006 wants to merge 1 commit intosugarlabs:masterfrom
stutijain2006:ReflectionTest
Open

Fix module export for reflection.js to enable proper Jest coverage re…#5940
stutijain2006 wants to merge 1 commit intosugarlabs:masterfrom
stutijain2006:ReflectionTest

Conversation

@stutijain2006
Copy link
Contributor

This PR updates reflection.js to properly export the ReflectionMatrix class using module.exports.
Previously, the test file was loading the source dynamically using new Function(), which prevented Jest from instrumenting the file for coverage. As a result, reflection.js was showing 0% coverage, even though comprehensive tests already existed.

Changes made-

  • Added proper CommonJS export:
    module.exports = ReflectionMatrix;

  • Updated the test file to import the module using:
    const ReflectionMatrix = require("../reflection");

  • Removed dynamic evaluation via new Function() in tests.

Impact-

  • Jest can now correctly instrument reflection.js.
  • Coverage for reflection.js is now correctly reported (~84%).

@github-actions
Copy link
Contributor

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

1 similar comment
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant