test(esbuild): fix invoke-local outExtension test on Windows#13743
test(esbuild): fix invoke-local outExtension test on Windows#13743czubocha merged 1 commit intomainserverless/serverless:mainfrom fix/esbuild-invoke-local-test-windowsserverless/serverless:fix/esbuild-invoke-local-test-windowsCopy head branch name to clipboard
Conversation
The child-process driver imported the plugin via a raw filesystem path, which Node's ESM loader rejects as an import specifier on Windows (ERR_UNSUPPORTED_ESM_URL_SCHEME), producing empty stdout and failing all four assertions. Import via a file:// URL and surface driver startup errors instead of exiting silently.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe invoke-local extension test now converts the plugin path to a ChangesInvoke-local plugin loading
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
invoke localoutExtensionunit test on Windows, where all four assertions failed with empty outputRoot cause
The test spawns a Node child process whose driver script imported the plugin through a raw filesystem path. On Windows a drive-letter path (
C:\...) is not a valid ESM import specifier — Node's loader throwsERR_UNSUPPORTED_ESM_URL_SCHEMEat module evaluation, before the driver prints anything, so the child produced empty stdout and every assertion saw"". On POSIX the absolute path was accepted as a specifier, so the test passed on Linux and macOS.Fix
file://URL (pathToFileURL(...).href), which is a valid specifier on all platformstryblock and print a diagnostic on failure, so a future startup error surfaces a code instead of silently exiting with empty outputTest plan
test/unit/lib/plugins/aws/invoke-local/out-extension.test.jspasses (4/4); lint and prettier cleanERR_UNSUPPORTED_ESM_URL_SCHEME(reproducing the Windows failure) while thefile://URL loads correctlyNo production code changes; test-only.
Summary by CodeRabbit
.mjs,.cjs, and JavaScript module formats.