Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

test(esbuild): fix invoke-local outExtension test on Windows#13743

Merged
czubocha merged 1 commit into
mainserverless/serverless:mainfrom
fix/esbuild-invoke-local-test-windowsserverless/serverless:fix/esbuild-invoke-local-test-windowsCopy head branch name to clipboard
Jul 24, 2026
Merged

test(esbuild): fix invoke-local outExtension test on Windows#13743
czubocha merged 1 commit into
mainserverless/serverless:mainfrom
fix/esbuild-invoke-local-test-windowsserverless/serverless:fix/esbuild-invoke-local-test-windowsCopy head branch name to clipboard

Conversation

@czubocha

@czubocha czubocha commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix the invoke local outExtension unit test on Windows, where all four assertions failed with empty output

Root 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 throws ERR_UNSUPPORTED_ESM_URL_SCHEME at 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

  • Import the plugin through a file:// URL (pathToFileURL(...).href), which is a valid specifier on all platforms
  • Import inside the driver's try block and print a diagnostic on failure, so a future startup error surfaces a code instead of silently exiting with empty output

Test plan

  • test/unit/lib/plugins/aws/invoke-local/out-extension.test.js passes (4/4); lint and prettier clean
  • Verified a raw drive-letter specifier throws ERR_UNSUPPORTED_ESM_URL_SCHEME (reproducing the Windows failure) while the file:// URL loads correctly

No production code changes; test-only.

Summary by CodeRabbit

  • Bug Fixes
    • Improved local invocation handling for extensionless handlers across .mjs, .cjs, and JavaScript module formats.
    • Ensured missing handlers continue to report a clear initialization error.

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.
@Mmarzex

Mmarzex commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 66620d41-770b-4518-80d1-14fd13249856

📥 Commits

Reviewing files that changed from the base of the PR and between 8b96e2b and 64fdc6f.

📒 Files selected for processing (1)
  • packages/serverless/test/unit/lib/plugins/aws/invoke-local/out-extension.test.js

📝 Walkthrough

Walkthrough

The invoke-local extension test now converts the plugin path to a file:// URL, passes it to the child-process driver, and dynamically imports the plugin to validate extensionless handler resolution across supported module formats.

Changes

Invoke-local plugin loading

Layer / File(s) Summary
Pass and import plugin URL
packages/serverless/test/unit/lib/plugins/aws/invoke-local/out-extension.test.js
The test derives a file:// URL from the plugin path, passes it to the child driver, and uses dynamic import for plugin loading.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a Windows-specific fix for the invoke-local outExtension test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/esbuild-invoke-local-test-windows

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@czubocha
czubocha merged commit 13d8d52 into main Jul 24, 2026
11 of 12 checks passed
@czubocha
czubocha deleted the fix/esbuild-invoke-local-test-windows branch July 24, 2026 16:23
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.