-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
mocha devDependency adds content to node_modules after npm install --production #4474
Comments
in your test repo, your I don't understand this |
@boneskull the purpose of that is simply to demonstrate that a dev dependency should not contribute anything to the contents of a node_modules folder when |
OK. Well, I can certainly reproduce it. but what I can't do is tell you why it's happening. this looks like an npm bug to me. try $ yarn install --production and find that it seems to have something to do with the lack of |
see npm/cli#1113 |
I'm going to close this as I don't think it's a Mocha bug. I'm not sure what else to do... I wonder if downgrading |
@boneskull we've already seen the bug 1113 report at the npm issued board. That bug was reported way back in April, and doesn't explain why we started seeing this behavior in mocha starting on October 1st. I have build artifacts showing that the behavior did not manifest at all up to and including September 30th. Could it be that one of the mocha dependencies, such as eslint, received a version bump where a shrinkwrap was introduced? If that's the case, could this be an issue that could be corrected in mocha by falling back to a lower dependency version? |
It's an |
This is great news, thank you. Will keep an eye on #4476 |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Sometime between Wednesday September 30th 2020 and Thursday October 1st 2020, the behavior of mocha during a clean
npm install --production
changed. Previously, the command resulted in no node_modules folder being created. Since, the command has consitently resulted in the creation of a node_modules folder with the following contents:Steps to Reproduce
git clone https://github.com/danludwig/npm-module-bug-reports.git
cd npm-module-bug-reports/mocha-2020-10-bug
./package.json
has only a devDependency on mochanpm install --production
Expected behavior: [What you expect to happen]
Assuming the commands to reproduce above were followed, continue with:
cd ../mocha-2020-10-expected
./package.json
has only a devDependency on chainpm install --production
Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
100% since October 1st 2020. 0% on and before September 30, 2020
Versions
mocha --version
andnode node_modules/.bin/mocha --version
: 8.1.3node --version
: v12.13.0Additional Information
This is an important issue as AWS Lambda@Edge code packages have a size limitation of 1048576 bytes, and the automated build tooling provided by AWS SAM will include these node_modules contents, violating the service limit. The only workaround is to add a cleanup step in the build process to delete the node_modules folder after building but before publishing the package for use in Lambda@Edge.
The text was updated successfully, but these errors were encountered: