-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fund): correctly parse and use
which
config
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.
- Loading branch information
1 parent
72e6d6f
commit 669ef94
Showing
3 changed files
with
443 additions
and
396 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,7 @@ | |
exports[`test/lib/commands/fund.js TAP fund a package with type and multiple sources > should print prompt select message 1`] = ` | ||
1: Foo funding available at the following URL: http://example.com/foo | ||
2: Lorem funding available at the following URL: http://example.com/foo-lorem | ||
Run \`npm fund [<@scope>/]<pkg> --which=1\`, for example, to open the first funding URL listed in that package | ||
Run \`npm fund [<package-spec>] --which=1\`, for example, to open the first funding URL listed in that package | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund colors > should print output with color info 1`] = ` | ||
|
@@ -23,7 +22,6 @@ exports[`test/lib/commands/fund.js TAP fund colors > should print output with co | |
[0m \`-- [40m[37mhttp://example.com/e[39m[49m[0m | ||
[0m \`-- [email protected][0m | ||
[0m[0m | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund containing multi-level nested deps with no funding > should omit dependencies with no funding declared 1`] = ` | ||
|
@@ -33,54 +31,37 @@ [email protected] | |
\`-- http://example.com/donate | ||
\`-- [email protected] | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund in which same maintainer owns all its deps > should print stack packages together 1`] = ` | ||
http://example.com/donate | ||
\`-- [email protected], [email protected], [email protected], [email protected] | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund pkg missing version number > should print name only 1`] = ` | ||
http://example.com/foo | ||
\`-- foo | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund using bad which value: index too high > should print message about invalid which 1`] = ` | ||
--which=100 is not a valid index | ||
1: Funding available at the following URL: http://example.com | ||
2: Funding available at the following URL: http://sponsors.example.com/me | ||
3: Funding available at the following URL: http://collective.example.com | ||
Run \`npm fund [<package-spec>] --which=1\`, for example, to open the first funding URL listed in that package | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund using nested packages with multiple sources > should prompt with all available URLs 1`] = ` | ||
1: Funding available at the following URL: https://one.example.com | ||
2: Funding available at the following URL: https://two.example.com | ||
Run \`npm fund [<@scope>/]<pkg> --which=1\`, for example, to open the first funding URL listed in that package | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund using nested packages with multiple sources, with a source number > should open the numbered URL 1`] = ` | ||
Funding available at the following URL: | ||
https://one.example.com | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund using package argument > should open funding url 1`] = ` | ||
individual funding available at the following URL: | ||
http://example.com/donate | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund using pkg name while having conflicting versions > should open greatest version 1`] = ` | ||
Funding available at the following URL: | ||
http://example.com/2 | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund using string shorthand > should open string-only url 1`] = ` | ||
Funding available at the following URL: | ||
https://example.com/sponsor | ||
Run \`npm fund [<package-spec>] --which=1\`, for example, to open the first funding URL listed in that package | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP fund with no package containing funding > should print empty funding info 1`] = ` | ||
[email protected] | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP sub dep with fund info and a parent with no funding info > should nest sub dep as child of root 1`] = ` | ||
|
@@ -90,25 +71,22 @@ [email protected] | |
\`-- http://example.com/c | ||
\`-- [email protected] | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP workspaces filter funding info by a specific workspace > should display only filtered workspace name and its deps 1`] = ` | ||
exports[`test/lib/commands/fund.js TAP workspaces filter funding info by a specific workspace name > should display only filtered workspace name and its deps 1`] = ` | ||
[email protected] | ||
\`-- https://example.com/a | ||
| \`-- [email protected] | ||
\`-- http://example.com/c | ||
\`-- [email protected] | ||
` | ||
|
||
exports[`test/lib/commands/fund.js TAP workspaces filter funding info by a specific workspace > should display only filtered workspace path and its deps 1`] = ` | ||
exports[`test/lib/commands/fund.js TAP workspaces filter funding info by a specific workspace path > should display only filtered workspace name and its deps 1`] = ` | ||
[email protected] | ||
\`-- https://example.com/a | ||
| \`-- [email protected] | ||
\`-- http://example.com/c | ||
\`-- [email protected] | ||
` |
Oops, something went wrong.