mocha icon indicating copy to clipboard operation
mocha copied to clipboard

fix: support canonical module

Open JacobLey opened this issue 2 years ago • 2 comments

Description of the Change

Handle canonicalizing Module, prevent implicit stringification failures

Alternate Designs

  • Have canonicalType return 'object' for modules (not chosen as that could be breaking, not sure...)
  • Have 'module' fallthrough to 'object' with no custom logic (not chosen so we can indicate different between "object" and "module")

Why should this be in core?

Current module canonicalization is broken, see https://github.com/mochajs/mocha/issues/4887

Benefits

Tests can properly handle errors with a Module inside

Possible Drawbacks

Small chance there is some internal/custom handling expecting canonicalization of modules to fail... Seems unlikely?

Applicable issues

Fixes https://github.com/mochajs/mocha/issues/4887

Bug fix, patch release

JacobLey avatar May 22 '22 20:05 JacobLey

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: JacobLey / name: Jacob Ley (166046234c74da1a56d07ac73e44d1940663582e, 0264c7fc7195488816320363a65dffd92b78c829)

Coverage Status

Coverage increased (+0.005%) to 94.332% when pulling 0264c7fc7195488816320363a65dffd92b78c829 on JacobLey:canonicalModule into 023f548213e571031b41cabbcb8bb20e458b2725 on mochajs:master.

coveralls avatar May 22 '22 20:05 coveralls

This PR hasn't had any recent activity, and I'm labeling it stale. Remove the label or comment or this PR will be closed in 14 days. Thanks for contributing to Mocha!

github-actions[bot] avatar Sep 23 '22 00:09 github-actions[bot]

Still an active issue

JacobLey avatar Sep 23 '22 00:09 JacobLey

This PR hasn't had any recent activity, and I'm labeling it stale. Remove the label or comment or this PR will be closed in 14 days. Thanks for contributing to Mocha!

github-actions[bot] avatar Jan 25 '23 00:01 github-actions[bot]

Bump

JacobLey avatar Jan 25 '23 01:01 JacobLey

This PR hasn't had any recent activity, and I'm labeling it stale. Remove the label or comment or this PR will be closed in 14 days. Thanks for contributing to Mocha!

github-actions[bot] avatar May 29 '23 00:05 github-actions[bot]

👋 coming back to this @JacobLey, are you still interested in working on this PR? As of https://github.com/mochajs/mocha/issues/5027 there are maintainers who can review it now. No worries if you no longer have time - but if you do that'd be great!

JoshuaKGoldberg avatar Dec 02 '23 20:12 JoshuaKGoldberg

Sure, from what I can tell the commit is easily merged with latest mainline, and the solution should still be the same.

I have updated the branch, but don't believe I have power to re-open this PR.

Opened a new PR with the same commits (rebased off master): https://github.com/mochajs/mocha/pull/5040

JacobLey avatar Dec 04 '23 03:12 JacobLey