-
-
Notifications
You must be signed in to change notification settings - Fork 602
test: use verdaccio for e2e init testing #4100
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
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
|
Note that this PR is also blocking releases in |
|
@SocketSecurity ignore npm/jws@3.2.3 seems fine |
Our
inittests have a release blocking issue at the momentGiven:
yarn lerna:version, which bumps all versions in Electron Forge to the next semantic release version without tagging or releasing.Then:
inittests run against the current build of Forge. They will attempt to install an unreleased version for any version bump PR and the tests will fail.For an example of this in action, see #4094.
Solution
Verdaccio is an npm proxy registry. This PR adds a new
spawn-verdaccio.tstool script that runs a new instance of the registry on localhost and runs thelerna publishcommand on Forge with the--registryflag pointing to Verdaccio.Then, the script will attempt to run any command that it's fed through args with an additional set of environment variables to correctly point the package manager to Verdaccio (
NPM_CONFIG_REGISTRY,YARN_NPM_REGISTRY_SERVER,YARN_UNSAFE_HTTP_WHITELIST).Alternatives considered
Initially, I tried to modify
initLinkto point all Forge deps tofile:protocol. This worked fine withnpm, but fell apart a bit with Yarn and pnpm when dealing with theworkspace:protocol (albeit I also tried to wire up localnode_modulesdependencies viafile:protocol as well and that caused more issues).In the end, I chose the Verdaccio solution since it's package manager-agnostic. It's not a perfect replacement for
initLinksince it doesn't respond to changes in the original JavaScript code (it just tarballs thedistfolder), but works well in tests and CI.Caveats
lerna publish(even to Verdaccio) requires a clean working tree, so you'll need to commit all changes before runningyarn test:verdaccio. Any tests that leave committable artifacts will also mess up the Verdaccio tests because Lerna will be unable to publish.yarn config setdynamically in CI will cause these tests to fail because it modifies.yarnrc.ymlon the fly.inittests currently run against Verdaccio, but there might be room in the future to do so with other tests that install deps (e.g. TypeScript template tests).