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
path: root/test
AgeCommit message (Collapse)Author
2021-12-09feat: display `publishConfig` during `config list`Luke Karrys
Closes: npm/statusboard#417 If the file at `$NPM_CONFIG_PREFIX/package.json` contains a `publishConfig`, the key/value pairs will be printed along with the rest of the output from `npm config ls`. PR-URL: https://github.com/npm/cli/pull/4146 Credit: @lukekarrys Close: #4146 Reviewed-by: @nlf
2021-12-09fix: output configured registry during publishLuke Karrys
Closes: npm/statusboard#416 PR-URL: https://github.com/npm/cli/pull/4143 Credit: @lukekarrys Close: #4143 Reviewed-by: @wraithgar
2021-12-09fix: redact all private keys from config outputLuke Karrys
PR-URL: https://github.com/npm/cli/pull/4142 Credit: @lukekarrys Close: #4142 Reviewed-by: @wraithgar
2021-12-09fix: dont warn on error cleaning individual log filesLuke Karrys
Closes: #4128 This also refactors the logic for cleaning log files to use the `ignore` option from `glob` to not clean current log files instead of relying on updating the `logs-max` count. I also discovered a bug where we weren't cleaning log files written with the old naming convention, so this fixes that as well. PR-URL: https://github.com/npm/cli/pull/4134 Credit: @lukekarrys Close: #4134 Reviewed-by: @wraithgar
2021-12-02chore: update one-time password promptDarcy Clarke
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-22fix: add missing scope on flat optionsYucel Okcu
PR-URL: https://github.com/npm/cli/pull/4060 Credit: @yuqu Close: #4060 Reviewed-by: @wraithgar
2021-11-22chore: remove get-project-scope utilsYucel Okcu
2021-11-18chore: more faithfully mock global.process in testisaacs
PR-URL: https://github.com/npm/cli/pull/4052 Credit: @isaacs Close: #4052 Reviewed-by: @wraithgar
2021-11-11chore: refactor audit testsGar
Use a real npm object, actually assert things PR-URL: https://github.com/npm/cli/pull/4036 Credit: @wraithgar Close: #4036 Reviewed-by: @lukekarrys
2021-11-11fix(install): command completion with single matchGar
During a refactoring of the tests a bug was found in the install command completion that would return nothing if there was a valid match, this fixes that bug and also makes the tests actually test things. PR-URL: https://github.com/npm/cli/pull/4023 Credit: @wraithgar Close: #4023 Reviewed-by: @lukekarrys
2021-11-11fix: command completionGar
The fake npm object in the tests wasn't returning an async function Fixes: https://github.com/npm/cli/issues/4020 PR-URL: https://github.com/npm/cli/pull/4032 Credit: @wraithgar Close: #4032 Reviewed-by: @lukekarrys
2021-11-11fix: clean up birthday commandGar
Clean up tests too PR-URL: https://github.com/npm/cli/pull/4033 Credit: @wraithgar Close: #4033 Reviewed-by: @lukekarrys
2021-11-10fix: explicitly allow `npm help` to open file:/// man pagesGar
PR-URL: https://github.com/npm/cli/pull/4026 Credit: @wraithgar Close: #4026 Reviewed-by: @isaacs
2021-11-10fix: don't try to open file:/// urlsGar
These are never valid in the contexts from which this lib is called. Namely these are the bugs, docs, fund, help, and repo commands, and for oauth logins. PR-URL: https://github.com/npm/cli/pull/4025 Credit: @wraithgar Close: #4025 Reviewed-by: @isaacs
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-04fix: make prefixed usage errors more consistentLuke Karrys
PR-URL: https://github.com/npm/cli/pull/3987 Credit: @lukekarrys Close: #3987 Reviewed-by: @wraithgar
2021-11-04fix(help|edit): use npm.exec, use file:///Gar
Windows no longer allows `file://`, but instead requires `file:///` for local file urls. Also after the command refactor things shifted and the tests didn't catch that the help pages didn't work at all anymore, and that the post-edit rebuild didn't work. This cleans up those two issues. PR-URL: https://github.com/npm/cli/pull/3994 Credit: @wraithgar Close: #3994 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: remove usage of unnecessary util.promisifyLuke Karrys
This is safe to do now that we've dropped node 10 support. PR-URL: https://github.com/npm/cli/pull/3988 Credit: @lukekarrys Close: #3988 Reviewed-by: @wraithgar
2021-11-04fix: shrinkwrap setting incorrect lockfileVersionLuke Karrys
Fix: #3962 When created from a hidden lockfile, shrinkwrap was always setting the lockfileVersion to 3. The shrinkwrap command also needed to be updated to log the correct message based on the lockfileVersion config instead of the static lockfileVersion. With these fixes, it was possible to log a better message whenever we are changing the lockfileVersion, either from a config or any existing lockfile. Lastly, the tests for shrinkwrap were completely refactored to use the real npm and test all conceivable scenarios, as well as removing usage of `util.promisify` in favor of `fs.promises` now that we've dropped support for Node 10. PR-URL: https://github.com/npm/cli/pull/3978 Credit: @lukekarrys Close: #3978 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-10-27fix: allow `--lockfile-version` config to be string and coerce to numberPelle Wessman
As all CLI input is considered to be string, eg. a "npm install --lockfile-version 3" would fail with the error messages: ``` npm WARN invalid config lockfile-version="3" set in command line options npm WARN invalid config Must be one of: null, 1, 2, 3 ``` Until we have a config system that supports setting type and possible values of configs, we have to specify all string and number values for the `lockfile-version`, but we coerce all values to numbers in the flattener. Co-authored-by: @voxpelli Co-authored-by: @isaacs PR-URL: https://github.com/npm/cli/pull/3949 Credit: @lukekarrys Close: #3949 Reviewed-by: @isaacs
2021-10-15feat(workspaces): add --include-workspace-root and explicit --no-workspacesfritzy/workspace-rootGar
Adds a new config item that includes the workspace root. This also changes --workspaces to a trinary, so that setting it to false will explicitly exclude workspaces altogether. PR-URL: https://github.com/npm/cli/pull/3890 Credit: @fritzy Close: #3890 Reviewed-by: @wraithgar
2021-10-07chore: fix publish testsGar
When the tests are run but the code is not inside a git repo, the results are different. This removes the `gitHead` altogether from the publish results so it works in all environments PR-URL: https://github.com/npm/cli/pull/3845 Credit: @wraithgar Close: #3845 Reviewed-by: @fritzy
2021-10-07feat: drop node 10, 11, and programmatic apiGar
BREAKING CHANGE: - Drop official support for node versions less than v12. - Drop support for `require('npm')` - Update a few subdependencies that dropped node10 support, and brought in the latest node-gyp PR-URL: https://github.com/npm/cli/pull/3762 Credit: @wraithgar Close: #3762 Reviewed-by: @fritzy
2021-09-30Revert "feat(workspaces): --include-workspace-root"Luke Karrys
This reverts commit f17dfa0ced7d8df9bb7baf378bb20d33175c8e8b.
2021-09-30feat(workspaces): --include-workspace-rootGar
Adds a new config item that includes the workspace root when running non-arborist commands (i.e. repo, version, publish). Arborist will need to be udpated to look for this flag to change its behavior to include the workspace root for its functions. This also changes --workspaces to a trinary, so that setting it to false will explicitly exclude workspaces altogether. This is also going to require an arborist change so that it ignores workspaces altogether. Co-author: @fritzy PR-URL: https://github.com/npm/cli/pull/3816 Credit: @isaacs Close: #3816 Reviewed-by: @wraithgar
2021-09-28fix: restore exit code on "npm outdated"gfyoung
closes: https://github.com/npm/cli/issues/2556 xref: https://github.com/npm/cli/pull/1750 The xref'ed PR apparently dropped this behavior without any explanation. PR-URL: https://github.com/npm/cli/pull/3799 Credit: @gfyoung Close: #3799 Reviewed-by: @wraithgar
2021-09-27fix: encode url before openingGar
will filter out a small subset of non-URL-safe characters that still parse properly with `new URL` PR-URL: https://github.com/npm/cli/pull/3804 Credit: @isaacs Close: #3804 Reviewed-by: @wraithgar
2021-09-16fix(logs): clean args for failed commandsGar
PR-URL: https://github.com/npm/cli/pull/3761 Credit: @wraithgar Close: #3761 Reviewed-by: @lukekarrys
2021-09-15fix(search): return valid json for no resultsAyush Rawal
PR-URL: https://github.com/npm/cli/pull/3738 Credit: @AyushRawal Close: #3738 Reviewed-by: @wraithgar
2021-09-14fix(config): user-agent properly shows ciGar
The way we were flattening user-agent back into itself meant that any values that were dependent on other config items would never be seen, since we have to re-flatten the item for each one it depends on. We also weren't re-flattening the user-agent when setting workspaces or workspace, which were things that affected the final result. This does change the main config value of `user-agent` but not the flattened one. We are not using the main config value anywhere (which is correct). PR-URL: https://github.com/npm/cli/pull/3754 Credit: @wraithgar Close: #3754 Reviewed-by: @nlf
2021-09-13fix(view): Show the correct publish date for versions selected by rangeAnders Kaseorg
Before, `npm view npm@^6` would incorrectly report “published over a year from now” for every entry. Now it reports the correct dates. PR-URL: https://github.com/npm/cli/pull/3739 Credit: @andersk Close: #3739 Reviewed-by: @wraithgar
2021-09-13fix(did-you-mean): succeed if cwd is not a packageGar
The did-you-mean code was trying to parse a local package.json to suggest scripts and bins, which was causing an exception if you ran npm outside of a directory with a valid package.json. This fixes that. PR-URL: https://github.com/npm/cli/pull/3747 Credit: @wraithgar Close: #3747 Reviewed-by: @nlf
2021-09-09feat(install): very strict global npm enginesGar
This will do an engines check when installing npm globally and fail if the new npm is known not to work in the current node version. It will not work for older npm versions because they don't have an engines field (it wasn't added till npm@6.14.0). It will at least prevent npm@7 from being installed in node@8. PR-URL: https://github.com/npm/cli/pull/3731 Credit: @wraithgar Close: #3731 Reviewed-by: @nlf
2021-09-09fix(error-message): clean urls from 404 errorGar
If the package being installed is a url it needs to be cleaned before logging so passwords aren't potentially logged. PR-URL: https://github.com/npm/cli/pull/3732 Credit: @wraithgar Close: #3732 Reviewed-by: @nlf
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-08-26chore: fix gitHead snapshots againGar
Somehow the last one didn't take?
2021-08-19@npmcli/arborist@2.8.2Gar
* fix: treat top-level global packages as "top" nodes * fix: load global symlinks implicitly as file: deps * fix(reify): debug crash when extracting into symlink * fix: node_modules must be a directory * fix: make Node.children() a case-insensitive Map * fix(reify): verify existing deps in nm are dirs
2021-08-18fix(error-message): look for er.path not er.fileGar
The attribute is here, er.file was used in error on another lib, the lib got changed, and this code wasn't fixed. PR-URL: https://github.com/npm/cli/pull/3661 Credit: @wraithgar Close: #3661 Reviewed-by: @fritzy
2021-08-18feat(cache): initial implementation of ls and rmNathan Fritz
PR-URL: https://github.com/npm/cli/pull/3592 Credit: @fritzy Close: #3592 Reviewed-by: @nlf
2021-08-17fix(logging): sanitize logged argvGar
Wraps logged process.argv in `replaceInfo` Removes logged process.argv from EJSONPARSE warning for top level package.json merge conflicts. It is currently not even working (er.file is not being populated by the parsing library right now), and process.argv contains fullly resolved paths which isn't very nice looking. The user knows what they typed, it's enough to tell them to retry. PR-URL: https://github.com/npm/cli/pull/3658 Credit: @wraithgar Close: #3658 Reviewed-by: @nlf
2021-08-11deps: remove byte-sizeGar
In its latest release, byte-size dropped support for node versions lower than 14. The cli currently supports node 10 and up. The actual functionality we needed and was using was extremely limited in scope, and didn't warrant an external module. It's just pretty printing a file size, and the files we are dealing with are limited in size so we don't need to support so many suffixes. PR-URL: https://github.com/npm/cli/pull/3569 Credit: @wraithgar Close: #3569 Reviewed-by: @isaacs
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-22fix(config): consolidate use of npm.colorGar
The config value for `color` should never be directly read by npm, or its submodules. The derived value `npm.color` or `npm.flatOptions.color` is what we want to use. This PR consolidates the use of these values, makes sure there is only one place the value is actually calculated, and stops relying on duplicated code in the setup-log.js file for setting one of them. PR-URL: https://github.com/npm/cli/pull/3563 Credit: @wraithgar Close: #3563 Reviewed-by: @lukekarrys
2021-07-22fix(exit-handler): always warn if not calledGar
If the exit handler wasn't called it is always a problem, even if there is no exit code. PR-URL: https://github.com/npm/cli/pull/3561 Credit: @wraithgar Close: #3561 Reviewed-by: @lukekarrys