Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add module loading tests for user function #124

Merged
merged 3 commits into from
Mar 13, 2025

Conversation

godcrampy
Copy link
Contributor

@godcrampy godcrampy commented Mar 11, 2025

Description of changes:
Add missing test scenarios:

  • CJS in extensionless (with and without package.json) (failure and success)
  • ESM in extensionless (with and without package.json) (failure and success)
  • CJS in .js (with and without package.json) (failure and success)
  • ESM in .js (with and without package.json) (failure and success)
  • CJS + ESM in same context (explicit failure)
  • CJS/ESM import/require combinations (failure and success)

Checklist

  • I have run npm install to generate the package-lock.json correctly and included it in the PR.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@maxday maxday self-requested a review March 12, 2025 10:44
@@ -1,12 +1,12 @@
{
"name": "aws-lambda-ric",
"version": "3.2.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a leftover from a previous bump? Maybe we should clearly state in the readme that package-lock should be commited

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Sure let me add it to the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated README and the PR template.

Copy link

@maxday maxday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳 great job

@@ -250,6 +251,166 @@ describe('UserFunction.load method', () => {

response.should.be.resolvedWith('moon');
});

it('should successfully load a CJS handler from extensionless file (no package.json)', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@godcrampy godcrampy merged commit 2ea9a34 into main Mar 13, 2025
7 checks passed
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.

3 participants