Age | Commit message (Collapse) | Author |
|
|
|
|
|
* Removed dedupe --save documentation and attempted implementation.
* Remove some unneeded otplease mocks from test
`npm dedupe --save` didn't work in a easy to understand way. It would
only update a top level dependency that was duplicated in the tree.
Found this out rewriting the dedupe tests to be real. This is not very
intuitive and it's best if folks use update or install for saving to
package.json.
|
|
It was only ever used by `npm edit` so it's inline now.
Rewrote `npm edit` tests to be real
|
|
This also allows logs-max to be set to 0 to disable log file writing.
Closes #4466
Closes #4206
|
|
The tests for unpublish were mocked so heavily they weren't actually
asserting anything. In rewriting them several bugs were found.
- `write=true` was not being consistenly used when fetching packument
data, it is now.
- The decision on when to load the local package.json file was not
working at all, that has been fixed. If the cwd contains a
package.json whose name matches the package you are uninstalling, the
local package.json will be read and its publishConfig applied to your
request.
- dead code inside the `npm unpublish` path was removed. There is no
need to check if you are unpublishing the last version here, you're
already unpublishing the entire project.
- publishConfig is now being applied through the config flatten method,
not a raw object assignment.
|
|
|
|
make tests pass in prefixDir instead of testdir
allow for cache and globalPrefix dirs
|
|
|
|
Previously `npm update` was not respecting the `save` option, it
would be impossible for users to use `npm update` and automatically
update their `package.json` files.
This fixes it by adding extra steps on `Arborist.reify._saveIdealTree`
to read direct dependencies of any `package.json` and update them as
needed when reifying using the `update` and `save` options.
- Uses config.isDefault to set a different value for the `save` config
for both the update and dedupe commands
- Tweaks arborist to make sure saveIdealTree preserves the behavior of
skipping writing to package-lock.json on save=false for install while
still writing the lockfile for `npm update` with its new default value
of save=false.
- Updated and added some new tests on arborist to cover for these tweaks
- Added `npm update --save` smoke test on cli
Fixes: https://github.com/npm/cli/issues/708
Fixes: https://github.com/npm/cli/issues/2704
Relates to: https://github.com/npm/feedback/discussions/270
|
|
This decouples the log file writing from the terminal logging. We now
open an append only file at the start of the process and stream logs to
it. We still only display the log file message in timing mode or if
there is an error, but the file is still written regardless.
All logging now goes through `proc-log` and this is the first step to
removing `npmlog`. For now `npmlog` is still used for the terminal
logging but with a shim in front of it to make it easier to test and
use in conjunction with `proc-log`. Ref: npm/statusboard#366
This also refactors many of the tests to always use an explicit
`t.testdir` for their cache since the file is opened on each `new Npm()`.
Tests are also refactored to use more of `MockNpm` with behavior to
add config items and load `npm` if necessary. A new fixture `mockGlobals`
was also added to make much of this more ergonomic. Ref: npm/statusboard#410
Closes npm/statusboard#411
Closes npm/statusboard#367
PR-URL: https://github.com/npm/cli/pull/4062
Credit: @lukekarrys
Close: #4062
Reviewed-by: @wraithgar
|
|
Uses the real npm object and doesn't mock anything.
PR-URL: https://github.com/npm/cli/pull/4018
Credit: @wraithgar
Close: #4018
Reviewed-by: @lukekarrys
|
|
This brings us in line with the rest of the linting rules we are wanting
to use on the npm cli repos.
There were several hundred over-length lines and instead of editing them
all by hand I piped the failing file through `prettier` and back through
`eslint` just to save some time and energy. This means there may be
some quirks in the linting those files have, but we can fix those if we
see them and they bother us.
Other than that there were about 50 lines that are legitimately
over-length, all are now explicitly overridden. Many are tests that
could be snapshots.
PR-URL: https://github.com/npm/cli/pull/3995
Credit: @wraithgar
Close: #3995
Reviewed-by: @lukekarrys
|
|
PR-URL: https://github.com/npm/cli/pull/3986
Credit: @lukekarrys
Close: #3986
Reviewed-by: @wraithgar
|
|
This is the first phase of refactoring the internal structure of the npm
commands to set us up for future changes. This iteration changes the
function signature of `exec` for all the commands to be a async (no more
callbacks), and also groups all the commands into their own
subdirectory.
It also removes the Proxy `npm.commands` object, in favor of an
`npm.cmd` and `npm.exec` function that breaks up the two things that
proxy was doing. Namely, getting to the attributes of a given command
(`npm.cmd` now does this), and actually running the command `npm.exec`
does this.
PR-URL: https://github.com/npm/cli/pull/3959
Credit: @wraithgar
Close: #3959
Reviewed-by: @lukekarrys
|
|
Order matters here so we clean the more specific things before the
generic ones.
PR-URL: https://github.com/npm/cli/pull/3687
Credit: @wraithgar
Close: #3687
Reviewed-by: @nlf
|
|
This corrects two things,
`--global` implies `--location=global` and `--package-lock-only` implies
`--package-lock`
It also introduces a new sandbox runner for testing purposes. it's not
the prettiest thing i've ever written, but it seems to do the job pretty
nicely and doesn't require keeping track of wild shenanigans everywhere.
Fixes #2747
Fixes #3572
PR-URL: https://github.com/npm/cli/pull/3684
Credit: @nlf
Close: #3684
Reviewed-by: @wraithgar
|
|
This moves a handful of the smaller tests to using the new npm mock that
uses the real actual npm object. It also extends the testing surface
area of a few tests back down into the actual `process.spawn` that
results, instead of anything internal to the code.
Some dead code in `lib/test.js` was found during this, as well as an
instance of a module throwing a string instead of an error object.
PR-URL: https://github.com/npm/cli/pull/3463
Credit: @wraithgar
Close: #3463
Reviewed-by: @nlf
|
|
Fix: #3138
PR-URL: https://github.com/npm/cli/pull/3588
Credit: @isaacs
Close: #3588
Reviewed-by: @wraithgar
|
|
* npm mock logger writes to npm.log.record too now
* No more extra process.exit from within the process `exit` event handle.
* No more `exit()` function. Logic is rolled up into the exit handler.
* Now there is only an exit handler and an exit event listener.
`lib/utils/perf.js` was rolled up into npm.js itself.
Unfortunately the tests were written in such a way that any further
refactoring of the exit handler was going to require also rewriting the
tests. Fortunately NOW the tests are interacting with the exit handler
in a way that shouldn't require them to be rewritten AGAIN if we change
the internals of the exit handler.
PR-URL: https://github.com/npm/cli/pull/3482
Credit: @wraithgar
Close: #3482
Reviewed-by: @nlf
|
|
Consolidates existing "real npm" mocks, labels it real. We can now
migrate tests to this one at a time instead of trying to make one giant
PR that does it all at once.
PR-URL: https://github.com/npm/cli/pull/3458
Credit: @wraithgar
Close: #3458
Reviewed-by: @nlf
|
|
The npm output function refers to this.log. libnpmexec has that passed
in, which decoupled the function from the npm object. This fixes it,
and sets the tests up in a way where if the output function ever becomes
detached from this.npm in the same way, tests will fail.
PR-URL: https://github.com/npm/cli/pull/3329
Credit: @wraithgar
Close: #3329
Reviewed-by: @ruyadorno
|
|
The mocked npm now uses all config defaults, ensuring we don't have bugs
from the disconnect between our currently heavily mocked tests and
reality. Eventually the npm mock will be closer to reality, this moves
the needle.
PR-URL: https://github.com/npm/cli/pull/3211
Credit: @wraithgar
Close: #3211
Reviewed-by: @ruyadorno
|
|
PR-URL: https://github.com/npm/cli/pull/3033
Credit: @wraithgar
Close: #3033
Reviewed-by: @darcyclarke
|
|
While it is somewhat helpful to get reports on this, since it indicates
an underlying problem in Arborist, it's also very disruptive and
unhelpful for users. As of 2.3.0, Arborist gives us the currentEdge if
available, so we _can_ report on that at least. If there is no node
_or_ edge, then we just don't say what the current state is, which isn't
useful, but at least is less annoying than a 'property of null'
exception.
PR-URL: https://github.com/npm/cli/pull/3015
Credit: @isaacs
Close: #3015
Reviewed-by: @wraithgar
|
|
Iterative change moving us towards a more unified config.
No longer pulling config from flatOptions where we don't have to.
PR-URL: https://github.com/npm/cli/pull/2892
Credit: @wraithgar
Close: #2892
Reviewed-by: @ruyadorno
|
|
PR-URL: https://github.com/npm/cli/pull/2381
Credit: @XhmikosR
Close: #2381
Reviewed-by: @isaacs
|
|
- Fixes `npm search --searchexclude=<value>` option
- Tweaks `--searchopt` logic
- Refactor and cleanup `lib/search.js`
- Add `test/lib/search.js` tests
- Fixes: https://github.com/npm/statusboard/issues/171
PR-URL: https://github.com/npm/cli/pull/2325
Credit: @ruyadorno
Close: #2325
Reviewed-by: @isaacs
|
|
Updates to ERESOLVE explanation code
|
|
|
|
When peerDependencies conflict, Arborist is now providing details of the
nodes and their reasons for inclusion on the Error object, including
whether or not this resolution error could be overridden using the
--force flag.
Print this data out in a minimal way as a warning if we override an
ERESOLVE forcefully. When the ERESOLVE causes the install to fail,
print a somewhat longer message, and save a MUCH longer full report to
the cache folder.
PR-URL: https://github.com/npm/cli/pull/1761
Credit: @isaacs
Close: #1761
Reviewed-by: @darcyclarke, @ruyadorno
|
|
|
|
Credit: @isaacs
Reviewed-By: @iarna
PR-URL: https://github.com/npm/npm/pull/16804
|
|
Credit: @baderbuddy
Reviewed-By: @iarna
PR-URL: https://github.com/npm/npm/pull/14435
|
|
instead, log the error using the warn log level and also log a notice
that the require failed.
Fixes: #10347
PR-URL: https://github.com/npm/npm/pull/11289
Credit: @evanlucas
Reviewed-By: @iarna
|
|
Closes #7202 by caching separate branches individually.
|
|
Some fixtures are necessary, but they should all be combined into one
place to signpost what they're for.
Part of #7929.
|
|
This is a tiny bit hacky, but for private registries using scopes and
tarball auth, it will ensure that the bearer token / basic auth
credentials are passed for tarball dependencies when all the credentials
are properly configured. See the test for details of how the
configuration should look.
|
|
|
|
|