test: do not depend on a global npm binary - #23326
Conversation
| "minimatch": "5.1.0", | ||
| "ng-packagr": "14.0.0", | ||
| "node-fetch": "^2.2.0", | ||
| "npm": "^8.11.0", |
There was a problem hiding this comment.
Would it be possible to use the in-repo version of yarn instead? This would avoid adding another dependency. yarn is also the package manager used for other development related tasks and configured for use by Bazel.
There was a problem hiding this comment.
Yeah I think we can do that.
This is just what is used to install the packages being tested so I don't think npm/yarn or the version really matters. Those packages being tested are the cli + yarn + npm and those are the versions which matter (yes, we are discussing the npm/yarn that installs cli+npm+yarn 😨).
There was a problem hiding this comment.
@clydin that seems to cause issues with some of the tests which use npm, and now npm and yarn are sharing the same directory which contains the globals? So they have the same globals directory but different global DBs I think?
Error: Running "npm install --global @angular/cli --registry=http://localhost:34837" returned error. 1...
STDOUT:
STDERR:
npm ERR! code EEXIST
npm ERR! path /mnt/ramdisk/e2e-main/npm-global/bin/ng
npm ERR! EEXIST: file already exists
npm ERR! File exists: /mnt/ramdisk/e2e-main/npm-global/bin/ng
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
Fixing that will probably require more changes that I'd rather not do right now. Are we ok sticking with the my original commit (46a029c)?
There was a problem hiding this comment.
Ok this actually had an easy and obvious fix... the global npm and yarn directories/databases just need to be separate. See diff
There was a problem hiding this comment.
Now yarn seems to be having other issues. I've seen an issue publishing saying there's a version conflict (the tested cli package depends on something that doesn't exist?), that might be related to this other one:
npm ERR! code E404
npm ERR! 404 Not Found - GET http://localhost:62353/pend - no such package available
npm ERR! 404
npm ERR! 404 'pend@~1.2.0' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
?
Are we ok going back to my original change keeping things as-is using npm? It just means installing the extra npm package...
There was a problem hiding this comment.
Here's the commit trying to switch to yarn: 975f92a
I'm going to switch this PR back to npm and we can maybe try yarn again in the future.
46a029c to
9d506c9
Compare
2a938ee to
975f92a
Compare
|
@jbedard, can you please rebase? |
|
Rebased |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When sandboxed in bazel there is no accessible npm and it must be installed manually some way or another. The npm shipped with node is also not accessible (see bazel-contrib/rules_nodejs#3467).
This
yarnnpm is for the test-runner to install the packages being tested, not for the tests themselves which use a custom cli/npm/yarn within the test process.Best attempt at using yarn: 975f92a