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

fix: check if module.paths really exists #4194

Merged
merged 1 commit into from
May 5, 2020

Conversation

ematipico
Copy link
Contributor

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions.

Description of the Change

module.paths was not defined when Mocha was run in an serverless environment. Probably due to the absence of node_modules folder. I had bundled the test using a bundler.

I added a check to make sure it doesn't throw an error.

Alternate Designs

Not sure if there are any other alternatives but open to suggestions.

Why should this be in core?

I don't think userland should mock module.paths.

Benefits

It would not throw an error during the execution of tests in a serverless environment.

Possible Drawbacks

I don't see any.

Applicable issues

Fixes #2505
This should be a bug fix

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 92.903% when pulling e548131 on ematipico:bugfix/module-paths into 4dc3cd1 on mochajs:master.

@outsideris
Copy link
Contributor

Serverless means AWS Lambda or Google Cloud Functions?

@ematipico
Copy link
Contributor Author

In my particular case, AWS Lambda

Copy link
Contributor

@boneskull boneskull left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

@boneskull boneskull added type: bug a defect, confirmed by a maintainer semver-patch implementation requires increase of "patch" version number; "bug fixes" labels May 5, 2020
@boneskull boneskull merged commit 8b6a76c into mochajs:master May 5, 2020
@craigtaub craigtaub added this to the next milestone May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch implementation requires increase of "patch" version number; "bug fixes" type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We shouldn't rely on the existence of "module.paths" (Meteor)
5 participants