fix: resolve #463 — Tests fail without any message if there are type errors#704
Conversation
…re type errors Fixes facebook#463 Signed-off-by: ed-thuando <231172918+ed-thuando@users.noreply.github.com>
|
|
@ed-thuando is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @ed-thuando! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
How does this fix the issue? The |
Summary
fix: resolve #463 — Tests fail without any message if there are type errors
Problem
Severity:
Medium| File:utils/testUtils.jsThe issue is that when testing TypeScript transforms with type errors, the tests fail silently without any error message. The
runTestfunction imports the transform module usingrequire(), but if there are TypeScript compilation errors (type errors), the require fails without providing any useful error message to the user. This makes debugging TypeScript issues very difficult.Solution
Modify the
runTestfunction inutils/testUtils.jsto wrap therequire(path.join(dirName, '..', transformName))call in a try-catch block. When an error is caught, log the error message withconsole.log('Error importing module', e)before allowing the test to proceed. This will ensure that even if the module has TypeScript type errors, the error will be visible to the user instead of the test just failing silently.Changes
utils/testUtils.js(modified)Testing
Generated by ContribAI v6.0.0