feat: added --linked-install#1
Open
Cxz324 wants to merge 300 commits into
Open
Conversation
Also increase docs tests so they dont timeout when rebuilding cmark-gfm
Using npm#5452 instead
This also replaces the previous check for known broken versions of node with an exception handler for syntax errors in order to try and give a nicer error message when attempting to run npm on older node versions. BREAKING CHANGE: `npm` is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0` Ref: npm/statusboard#519
Some of our tests were failing in windows after testing on node 18. The reason was the inability to clean up the logs dir. This changes forces a few tests to run in order and also cleans up any use of multiple `t.testdir` calls in a single child test which can cause problems.
BREAKING CHANGE: this removes the `npm bin` command The output of this command is misleading and incomplete. The `.bin` resolution of npm is much more nuanced than this command implies, and the output of `npm bin` is not something end users should be dealing with. `npm` itself is responsible for running the `bin` entries of modules, with the exception of global bins, which end up in the same folder as `node` itself, presumably already in a user's path since they can run node. Closes npm/statusboard#537
BREAKING CHANGE: this changes the default value of `install-links` to true Closes npm/statusboard#510
Co-authored by @bdehamer
### Refactor Config Reading During `exec` This removes the previous workarounds that were required due to tests setting configs that were not available in the constructor of the commands. This also made the fix for nodejs/node#45881 easier since the config checks for workspaces can now all be made in the command. The fix was to move the package.json detection to `@npmcli/config` and use that boolean instead of setting `location=project` which affected all commands such as `config set` saving to the wrong location. Some notable changes from this refactor include: - `execWorkspaces` no longer being passed the raw workspace filters and instead requiring `this.setWorkspaces()` to be called which was already being done in most commands - `static workspaces = [true|false]` on all commands to indicate workspaces support. This is used in docs generation and whether to throw when `execWorkspaces` is called or not. ### Drop `fakeMockNpm` and refactor `mockNpm` This refactor also drops `fakeMockNpm` in favor of `realMockNpm` (now just `mockNpm`), and adds new features to `mockNpm`. Some new features of `mockNpm`: - sets all configs via argv so they are parsed before `npm.load()`. This is the most important change as it more closely resembles real usage. - automatically resets `process.exitCode` - automatically puts global `node_modules` in correct testdir based on platform - more helpful error messages when used in unsupported ways - ability to preload a command for execution - sets `cwd` automatically to `prefix` and sets `globalPrefix` to the specified testdir Note that this commit does not include the actual test changes, which are included in the following commits for readability reasons. ### Linting This also removes some of the one off linting rules that were set in the past to reduce churn and fixes all remaining errors.
Previously the `which` param in `npm fund` was validated incorrectly leading to `EFUNDNUMBER` errors when used. This fixes that and does a better job detecting when `which` is pointing to an incorrect array bounds in the returned funding array.
This also refactors the test to use `mockNpm`
This also refactors the test to use `mockNpm`
This also uses more consistent snapshot cleaning where possible. Note that this is an iterative step for our tests and does not implement `MockRegistry` for them, so many of them still mock important functionality that should be tested. This refactor to `mockNpm` should make it easier to adopt `MockRegistry` as we see fit.
In links with fragments like `#checking-your-version-of-npm-and-node-js` the `node-js` portion doesn't work and should be `nodejs`. So for example, the following link currently on the site does NOT work (i.e. it won't scroll to relevant section): > https://docs.npmjs.com/cli/v9/configuring-npm/install#checking-your-version-of-npm-and-node-js ...but this one (as implemented by this fix) DOES work: > https://docs.npmjs.com/cli/v9/configuring-npm/install#checking-your-version-of-npm-and-nodejs
Owner
Author
Cxz324
commented
Mar 3, 2025
Cxz324
left a comment
Owner
Author
There was a problem hiding this comment.
TimeoutError: locator.click: Timeout 30000ms exceeded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
07a2129