Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-04chore: remove mocks from npm audit testsGar
2022-04-04chore: remove get-idendity mock from whoami testsGar
2022-04-04fix: remove dedupe --saveGar
* 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.
2022-03-30fix: consolidate split-package-namesGar
It was only ever used by `npm edit` so it's inline now. Rewrote `npm edit` tests to be real
2022-03-24feat: add logs-dir config to set custom logging locationLuke Karrys
This also allows logs-max to be set to 0 to disable log file writing. Closes #4466 Closes #4206
2022-03-24fix(unpublish): properly apply publishConfig (#4601)Gar
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.
2022-03-10chore: rewrite doctor testsGar
2022-03-10chore: mocknpm improvementsGar
make tests pass in prefixDir instead of testdir allow for cache and globalPrefix dirs
2022-02-24chore(cli): remove log option from being passed anywhereLuke Karrys
2022-01-20fix: npm update --save (#4223)Ruy Adorno
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
2021-12-02feat: streaming debug logfileLuke Karrys
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
2021-11-09chore: refactor pack testsGar
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
2021-11-05chore: update to latest eslint and linting rulesGar
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
2021-11-04chore: lint previously ignored filesLuke Karrys
PR-URL: https://github.com/npm/cli/pull/3986 Credit: @lukekarrys Close: #3986 Reviewed-by: @wraithgar
2021-11-04chore: refactor commandsGar
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
2021-08-26tests(config): fix snapshot cleanerGar
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
2021-08-26fix(config): respect --global, --package-lock-onlynlf
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
2021-07-29fix(tests): move more tests to use real npmGar
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
2021-07-29fix: update eresolve explanations for new arborist data providedisaacs
Fix: #3138 PR-URL: https://github.com/npm/cli/pull/3588 Credit: @isaacs Close: #3588 Reviewed-by: @wraithgar
2021-07-12chore(refactor): refactor exit handler and testsGar
* 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
2021-06-23chore(tests): expose real mock npm objectGar
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
2021-06-01fix(libnpmexec): don't detach output from npmGar
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
2021-05-10fix(tests): use config defaultsGar
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
2021-04-08feat(pack): add workspace supportGar
PR-URL: https://github.com/npm/cli/pull/3033 Credit: @wraithgar Close: #3033 Reviewed-by: @darcyclarke
2021-04-01Support reporting on ERESOLVE errors when current is missingisaacs
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
2021-03-18chore(config): remove flatOptions referencesGar
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
2020-12-18(docs,test): assorted typo fixesXhmikosR
PR-URL: https://github.com/npm/cli/pull/2381 Credit: @XhmikosR Close: #2381 Reviewed-by: @isaacs
2020-12-11fix: npm search include/excludeRuy Adorno
- 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
2020-10-13Integration code for @npmcli/arborist@1.0.0isaacs
Updates to ERESOLVE explanation code
2020-09-30chore: removed old test suiteRuy Adorno
2020-09-04Explain ERESOLVE errorsisaacs
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
2020-03-24Add note about third-party test fixture codeisaacs
2017-08-23tar: Remove use of old tarisaacs
Credit: @isaacs Reviewed-By: @iarna PR-URL: https://github.com/npm/npm/pull/16804
2016-11-18test/fixtures: Remove unused 0-byte package.jsonbaderbuddy
Credit: @baderbuddy Reviewed-By: @iarna PR-URL: https://github.com/npm/npm/pull/14435
2016-01-29npm: don't bail if require() onload-script throwsEvan Lucas
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
2015-05-01git: cache git repos by full URL (with branch)Rebecca Turner
Closes #7202 by caching separate branches individually.
2015-04-13test: move fixtures from test/tap to test/fixturesForrest L Norvell
Some fixtures are necessary, but they should all be combined into one place to signpost what they're for. Part of #7929.
2014-12-25find auth for shrinkwrapped deps (fixes #7011)Forrest L Norvell
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.
2014-10-17better errors for malformed .npmrc propertiesNick Santos
2014-10-16defactored npmconf back into npmForrest L Norvell