Skip to content

Commit 9ed2a6c

Browse files
committed
test(cmd): fixup integration tests for lstn manual command
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent d989587 commit 9ed2a6c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

cmd/root/root_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (suite *CmdAdditionalHelpSuite) SetupSuite() {
6565

6666
suite.expectedOuts[Environment] = "# lstn environment variables\n\nThe environment variables override any corresponding configuration setting.\n\nBut flags override them.\n\n`LSTN_ENDPOINT`: the listen.dev endpoint emitting the verdicts\n\n`LSTN_GH_OWNER`: set the GitHub owner name (org|user)\n\n`LSTN_GH_PULL_ID`: set the GitHub pull request ID\n\n`LSTN_GH_REPO`: set the GitHub repository name\n\n`LSTN_GH_TOKEN`: set the GitHub token\n\n`LSTN_IGNORE_DEPTYPES`: the list of dependencies types to not process\n\n`LSTN_IGNORE_PACKAGES`: the list of packages to not process\n\n`LSTN_LOGLEVEL`: set the logging level\n\n`LSTN_NPM_REGISTRY`: set a custom NPM registry\n\n`LSTN_REPORTER`: set one or more reporters to use\n\n`LSTN_SELECT`: filter the output verdicts using a jsonpath script expression (server-side)\n\n`LSTN_TIMEOUT`: set the timeout, in seconds\n\n"
6767

68-
suite.expectedOuts[Manual] = "# lstn cheatsheet\n\n## Global Flags\n\nEvery child command inherits the following flags:\n\n```\n--config string config file (default is $HOME/.lstn.yaml)\n```\n\n## `lstn completion <bash|fish|powershell|zsh>`\n\nGenerate the autocompletion script for the specified shell.\n\n### `lstn completion bash`\n\nGenerate the autocompletion script for bash.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n### `lstn completion fish [flags]`\n\nGenerate the autocompletion script for fish.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n### `lstn completion powershell [flags]`\n\nGenerate the autocompletion script for powershell.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n### `lstn completion zsh [flags]`\n\nGenerate the autocompletion script for zsh.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n## `lstn config`\n\nDetails about the ~/.lstn.yaml config file.\n\n## `lstn environment`\n\nWhich environment variables you can use with lstn.\n\n## `lstn exit`\n\nDetails about the lstn exit codes.\n\n## `lstn help [command]`\n\nHelp about any command.\n\n## `lstn in [path]`\n\nInspect the verdicts for your dependencies tree.\n\n### Flags\n\n```\n--json output the verdicts (if any) in JSON form\n```\n\n### Config Flags\n\n```\n--endpoint string the listen.dev endpoint emitting the verdicts (default \"https://npm.listen.dev\")\n--loglevel string set the logging level (default \"info\")\n--timeout int set the timeout, in seconds (default 60)\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n### Filtering Flags\n\n```\n-q, --jq string filter the output verdicts using a jq expression (requires --json)\n```\n\n### Registry Flags\n\n```\n--npm-registry string set a custom NPM registry (default \"https://registry.npmjs.org\")\n```\n\nFor example:\n\n```bash\nlstn in\nlstn in .\nlstn in /we/snitch\nlstn in sub/dir\n```\n\n## `lstn manual`\n\nA comprehensive reference of all the lstn commands.\n\n## `lstn reporters`\n\nA comprehensive guide to the `lstn` reporting mechanisms.\n\n## `lstn scan [path]`\n\nInspect the verdicts for your direct dependencies.\n\n### Flags\n\n```\n--json output the verdicts (if any) in JSON form\n```\n\n### Config Flags\n\n```\n--endpoint string the listen.dev endpoint emitting the verdicts (default \"https://npm.listen.dev\")\n--loglevel string set the logging level (default \"info\")\n--timeout int set the timeout, in seconds (default 60)\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n### Filtering Flags\n\n```\n --ignore-deptypes (dep,dev,optional,peer) the list of dependencies types to not process (default [bundle])\n --ignore-packages strings the list of packages to not process\n-q, --jq string filter the output verdicts using a jq expression (requires --json)\n-s, --select string filter the output verdicts using a jsonpath script expression (server-side)\n```\n\n### Registry Flags\n\n```\n--npm-registry string set a custom NPM registry (default \"https://registry.npmjs.org\")\n```\n\n### Reporting Flags\n\n```\n --gh-owner string set the GitHub owner name (org|user)\n --gh-pull-id int set the GitHub pull request ID\n --gh-repo string set the GitHub repository name\n-r, --reporter (gh-pull-check,gh-pull-comment,gh-pull-review) set one or more reporters to use (default [])\n```\n\n### Token Flags\n\n```\n--gh-token string set the GitHub token\n```\n\nFor example:\n\n```bash\nlstn scan\nlstn scan .\nlstn scan sub/dir\nlstn scan /we/snitch\nlstn scan /we/snitch --ignore-deptypes peer\nlstn scan /we/snitch --ignore-deptypes dev,peer\nlstn scan /we/snitch --ignore-deptypes dev --ignore-deptypes peer\nlstn scan /we/snitch --ignore-packages react,glob --ignore-deptypes peer\nlstn scan /we/snitch --ignore-packages react --ignore-packages glob,@vue/devtools\n```\n\n## `lstn to <name> [[version] [shasum] | [version constraint]]`\n\nGet the verdicts of a package.\n\n### Flags\n\n```\n--json output the verdicts (if any) in JSON form\n```\n\n### Config Flags\n\n```\n--endpoint string the listen.dev endpoint emitting the verdicts (default \"https://npm.listen.dev\")\n--loglevel string set the logging level (default \"info\")\n--timeout int set the timeout, in seconds (default 60)\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n### Filtering Flags\n\n```\n-q, --jq string filter the output verdicts using a jq expression (requires --json)\n-s, --select string filter the output verdicts using a jsonpath script expression (server-side)\n```\n\n### Registry Flags\n\n```\n--npm-registry string set a custom NPM registry (default \"https://registry.npmjs.org\")\n```\n\nFor example:\n\n```bash\n# Get the verdicts for all the chalk versions that listen.dev owns\nlstn to chalk\nlstn to debug 4.3.4\nlstn to react 18.0.0 b468736d1f4a5891f38585ba8e8fb29f91c3cb96\n\n# Get the verdicts for all the existing chalk versions\nlstn to chalk \"*\"\n# Get the verdicts for nock versions >= 13.2.0 and < 13.3.0\nlstn to nock \"~13.2.x\"\n# Get the verdicts for tap versions >= 16.3.0 and < 16.4.0\nlstn to tap \"^16.3.0\"\n# Get the verdicts for prettier versions >= 2.7.0 <= 3.0.0\nlstn to prettier \">=2.7.0 <=3.0.0\"\n```\n\n## `lstn version`\n\nPrint out version information.\n\n### Flags\n\n```\n-v, -- count increment the verbosity level\n --changelog output the relase notes URL\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n"
68+
suite.expectedOuts[Manual] = "# lstn cheatsheet\n\n## Global Flags\n\nEvery child command inherits the following flags:\n\n```\n--config string config file (default is $HOME/.lstn.yaml)\n```\n\n## `lstn completion <bash|fish|powershell|zsh>`\n\nGenerate the autocompletion script for the specified shell.\n\n### `lstn completion bash`\n\nGenerate the autocompletion script for bash.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n### `lstn completion fish [flags]`\n\nGenerate the autocompletion script for fish.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n### `lstn completion powershell [flags]`\n\nGenerate the autocompletion script for powershell.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n### `lstn completion zsh [flags]`\n\nGenerate the autocompletion script for zsh.\n\n#### Flags\n\n```\n--no-descriptions disable completion descriptions\n```\n\n## `lstn config`\n\nDetails about the ~/.lstn.yaml config file.\n\n## `lstn environment`\n\nWhich environment variables you can use with lstn.\n\n## `lstn exit`\n\nDetails about the lstn exit codes.\n\n## `lstn help [command]`\n\nHelp about any command.\n\n## `lstn in [path]`\n\nInspect the verdicts for your dependencies tree.\n\n### Flags\n\n```\n--genlock whether to generate the lock file on the fly or not\n--json output the verdicts (if any) in JSON form\n```\n\n### Config Flags\n\n```\n--endpoint string the listen.dev endpoint emitting the verdicts (default \"https://npm.listen.dev\")\n--loglevel string set the logging level (default \"info\")\n--timeout int set the timeout, in seconds (default 60)\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n### Filtering Flags\n\n```\n-q, --jq string filter the output verdicts using a jq expression (requires --json)\n```\n\n### Registry Flags\n\n```\n--npm-registry string set a custom NPM registry (default \"https://registry.npmjs.org\")\n```\n\nFor example:\n\n```bash\nlstn in\nlstn in .\nlstn in /we/snitch\nlstn in sub/dir\n```\n\n## `lstn manual`\n\nA comprehensive reference of all the lstn commands.\n\n## `lstn reporters`\n\nA comprehensive guide to the `lstn` reporting mechanisms.\n\n## `lstn scan [path]`\n\nInspect the verdicts for your direct dependencies.\n\n### Flags\n\n```\n--json output the verdicts (if any) in JSON form\n```\n\n### Config Flags\n\n```\n--endpoint string the listen.dev endpoint emitting the verdicts (default \"https://npm.listen.dev\")\n--loglevel string set the logging level (default \"info\")\n--timeout int set the timeout, in seconds (default 60)\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n### Filtering Flags\n\n```\n --ignore-deptypes (dep,dev,optional,peer) the list of dependencies types to not process (default [bundle])\n --ignore-packages strings the list of packages to not process\n-q, --jq string filter the output verdicts using a jq expression (requires --json)\n-s, --select string filter the output verdicts using a jsonpath script expression (server-side)\n```\n\n### Registry Flags\n\n```\n--npm-registry string set a custom NPM registry (default \"https://registry.npmjs.org\")\n```\n\n### Reporting Flags\n\n```\n --gh-owner string set the GitHub owner name (org|user)\n --gh-pull-id int set the GitHub pull request ID\n --gh-repo string set the GitHub repository name\n-r, --reporter (gh-pull-check,gh-pull-comment,gh-pull-review) set one or more reporters to use (default [])\n```\n\n### Token Flags\n\n```\n--gh-token string set the GitHub token\n```\n\nFor example:\n\n```bash\nlstn scan\nlstn scan .\nlstn scan sub/dir\nlstn scan /we/snitch\nlstn scan /we/snitch --ignore-deptypes peer\nlstn scan /we/snitch --ignore-deptypes dev,peer\nlstn scan /we/snitch --ignore-deptypes dev --ignore-deptypes peer\nlstn scan /we/snitch --ignore-packages react,glob --ignore-deptypes peer\nlstn scan /we/snitch --ignore-packages react --ignore-packages glob,@vue/devtools\n```\n\n## `lstn to <name> [[version] [shasum] | [version constraint]]`\n\nGet the verdicts of a package.\n\n### Flags\n\n```\n--json output the verdicts (if any) in JSON form\n```\n\n### Config Flags\n\n```\n--endpoint string the listen.dev endpoint emitting the verdicts (default \"https://npm.listen.dev\")\n--loglevel string set the logging level (default \"info\")\n--timeout int set the timeout, in seconds (default 60)\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n### Filtering Flags\n\n```\n-q, --jq string filter the output verdicts using a jq expression (requires --json)\n-s, --select string filter the output verdicts using a jsonpath script expression (server-side)\n```\n\n### Registry Flags\n\n```\n--npm-registry string set a custom NPM registry (default \"https://registry.npmjs.org\")\n```\n\nFor example:\n\n```bash\n# Get the verdicts for all the chalk versions that listen.dev owns\nlstn to chalk\nlstn to debug 4.3.4\nlstn to react 18.0.0 b468736d1f4a5891f38585ba8e8fb29f91c3cb96\n\n# Get the verdicts for all the existing chalk versions\nlstn to chalk \"*\"\n# Get the verdicts for nock versions >= 13.2.0 and < 13.3.0\nlstn to nock \"~13.2.x\"\n# Get the verdicts for tap versions >= 16.3.0 and < 16.4.0\nlstn to tap \"^16.3.0\"\n# Get the verdicts for prettier versions >= 2.7.0 <= 3.0.0\nlstn to prettier \">=2.7.0 <=3.0.0\"\n```\n\n## `lstn version`\n\nPrint out version information.\n\n### Flags\n\n```\n-v, -- count increment the verbosity level\n --changelog output the relase notes URL\n```\n\n### Debug Flags\n\n```\n--debug-options output the options, then exit\n```\n\n"
6969

7070
suite.expectedOuts[Exit] = "The lstn CLI follows the usual conventions regarding exit codes.\n\nMeaning:\n\n* when a command completes successfully, the exit code will be 0\n\n* when a command fails for any reason, the exit code will be 1\n\n* when a command is running but gets cancelled, the exit code will be 2\n\n* when a command meets an authentication issue, the exit code will be 4\n\nNotice that it's possible that a particular command may have more exit codes,\nso it's a good practice to check the docs for the specific command\nin case you're relying on the exit codes to control some behaviour.\n"
7171
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/spf13/cobra v1.7.0
2727
github.com/spf13/pflag v1.0.5
2828
github.com/spf13/viper v1.14.0
29-
github.com/stretchr/testify v1.8.4
29+
github.com/stretchr/testify v1.9.0
3030
github.com/thediveo/enumflag/v2 v2.0.5
3131
golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f
3232
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
568568
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
569569
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
570570
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
571-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
572-
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
571+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
572+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
573573
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
574574
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
575575
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=

0 commit comments

Comments
 (0)