Skip to content

Commit 78e110c

Browse files
committed
Update test snapshots for CLI help output
Update test snapshots reflecting changes in help text formatting and command output from dependency updates.
1 parent a274f1f commit 78e110c

File tree

1 file changed

+124
-61
lines changed

1 file changed

+124
-61
lines changed

src/commands/cli.test.mts

Lines changed: 124 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,70 +17,115 @@ describe('socket root command', async () => {
1717
async cmd => {
1818
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd)
1919
expect(stdout).toMatchInlineSnapshot(`
20-
"CLI for Socket.dev
21-
22-
Usage
23-
$ socket <command>
24-
$ socket scan create --json
25-
$ socket package score npm lodash --markdown
26-
27-
Note: All commands have their own --help
28-
29-
Main commands
30-
socket login Setup Socket CLI with an API token and defaults
31-
socket scan create Create a new Socket scan and report
32-
socket npm/lodash@4.17.21 Request the Socket score of a package
33-
socket fix Fix CVEs in dependencies
34-
socket optimize Optimize dependencies with @socketregistry overrides
35-
socket cdxgen Run cdxgen for SBOM generation
36-
socket ci Alias for \`socket scan create --report\` (creates report and exits with error if unhealthy)
37-
38-
Socket API
39-
analytics Look up analytics data
40-
audit-log Look up the audit log for an organization
41-
organization Manage Socket organization account details
42-
package Look up published package details
43-
repository Manage registered repositories
44-
scan Manage Socket scans
45-
threat-feed [Beta] View the threat-feed
46-
47-
Local tools
48-
manifest Generate a dependency manifest for certain ecosystems
49-
npm Wraps npm with Socket security scanning
50-
npx Wraps npx with Socket security scanning
51-
raw-npm Run npm without the Socket wrapper
52-
raw-npx Run npx without the Socket wrapper
53-
54-
CLI configuration
55-
config Manage Socket CLI configuration
56-
install Install Socket CLI tab completion
57-
login Socket API login and CLI setup
58-
logout Socket API logout
59-
uninstall Uninstall Socket CLI tab completion
60-
whoami Check Socket CLI authentication status
61-
wrapper Enable or disable the Socket npm/npx wrapper
62-
63-
Options
64-
Note: All commands have these flags even when not displayed in their help
65-
66-
--compact-header Use compact single-line header format (auto-enabled in CI)
67-
--config Override the local config with this JSON
68-
--dry-run Run without uploading
69-
--help Show help
70-
--help-full Show full help including environment variables
71-
--no-banner Hide the Socket banner
72-
--no-spinner Hide the console spinner
73-
--version Print the app version
74-
75-
Environment variables [more...]
76-
Use --help-full to view all environment variables"
20+
"usage: socketcli [-h] [--api-token <token>] [--repo <owner/repo>]
21+
[--repo-is-public] [--branch <name>] [--integration <type>]
22+
[--owner <name>] [--pr-number <number>]
23+
[--commit-message <message>] [--commit-sha <sha>]
24+
[--committers [<name> ...]] [--target-path <path>]
25+
[--sbom-file <path>] [--license-file-name <string>]
26+
[--save-submitted-files-list <path>]
27+
[--save-manifest-tar <path>] [--files <json>]
28+
[--sub-path <path>] [--workspace-name <name>]
29+
[--excluded-ecosystems EXCLUDED_ECOSYSTEMS]
30+
[--default-branch] [--pending-head] [--generate-license]
31+
[--enable-debug] [--enable-json] [--enable-sarif]
32+
[--disable-overview] [--exclude-license-details]
33+
[--allow-unverified] [--disable-security-issue]
34+
[--ignore-commit-files] [--disable-blocking] [--enable-diff]
35+
[--scm <type>] [--timeout <seconds>]
36+
[--include-module-folders] [--version]
37+
38+
The Socket Security CLI will get the head scan for the provided repo from
39+
Socket, create a new one, and then report any alerts introduced by the
40+
changes. Any new alerts will cause the CLI to exit with a non-Zero exit code
41+
(1 for error alerts, 5 for warnings).
42+
43+
options:
44+
-h, --help show this help message and exit
45+
--version show program's version number and exit
46+
47+
Authentication:
48+
--api-token <token> Socket Security API token (can also be set via
49+
SOCKET_SECURITY_API_KEY env var)
50+
51+
Repository:
52+
--repo <owner/repo> Repository name in owner/repo format
53+
--repo-is-public If set it will flag a new repository creation as
54+
public. Defaults to false.
55+
--branch <name> Branch name
56+
57+
Integration:
58+
--integration <type> Integration type of api, github, gitlab, azure, or
59+
bitbucket. Defaults to api
60+
--owner <name> Name of the integration owner, defaults to the socket
61+
organization slug
62+
63+
Pull Request and Commit:
64+
--pr-number <number> Pull request number
65+
--commit-message <message>
66+
Commit message
67+
--commit-sha <sha> Commit SHA
68+
--committers [<name> ...]
69+
Committer for the commit (comma separated)
70+
71+
Path and File:
72+
--target-path <path> Target path for analysis
73+
--sbom-file <path> SBOM file path
74+
--license-file-name <string>
75+
SBOM file path
76+
--save-submitted-files-list <path>
77+
Save list of submitted file names to JSON file for
78+
debugging purposes
79+
--save-manifest-tar <path>
80+
Save all manifest files to a compressed tar.gz archive
81+
with original directory structure
82+
--files <json> Files to analyze (JSON array string)
83+
--sub-path <path> Sub-path within target-path for manifest file scanning
84+
(can be specified multiple times). All sub-paths will
85+
be combined into a single workspace scan while
86+
preserving git context from target-path
87+
--workspace-name <name>
88+
Workspace name suffix to append to repository name
89+
(repo-name-workspace_name)
90+
--excluded-ecosystems EXCLUDED_ECOSYSTEMS
91+
List of ecosystems to exclude from analysis (JSON
92+
array string)
93+
94+
Branch and Scan Configuration:
95+
--default-branch Make this branch the default branch
96+
--pending-head If true, the new scan will be set as the branch's head
97+
scan
98+
--include-module-folders
99+
Enabling including module folders like node_modules
100+
101+
Output Configuration:
102+
--generate-license Generate license information
103+
--enable-debug Enable debug logging
104+
--enable-json Output in JSON format
105+
--enable-sarif Enable SARIF output of results instead of table or
106+
JSON format
107+
--disable-overview Disable overview output
108+
--exclude-license-details
109+
Exclude license details from the diff report (boosts
110+
performance for large repos)
111+
112+
Security Configuration:
113+
--allow-unverified Allow unverified packages
114+
--disable-security-issue
115+
Disable security issue checks
116+
117+
Advanced Configuration:
118+
--ignore-commit-files
119+
Ignore commit files
120+
--disable-blocking Disable blocking mode
121+
--enable-diff Enable diff mode even when using --integration api
122+
(forces diff mode without SCM integration)
123+
--scm <type> Source control management type
124+
--timeout <seconds> Timeout in seconds for API requests"
77125
`)
78126
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
79127
"
80-
_____ _ _ /---------------
81-
| __|___ ___| |_ ___| |_ | CLI: <redacted>
82-
|__ | * | _| '_| -_| _| | token: <redacted>, org: <redacted>
83-
|_____|___|___|_,_|___|_|.dev | Command: \`socket\`, cwd: <redacted>"
128+
"
84129
`)
85130

86131
expect(code, 'explicit help should exit with code 0').toBe(0)
@@ -98,6 +143,24 @@ describe('socket root command', async () => {
98143
)
99144
expect(`\n ${stderr}`).toMatchInlineSnapshot(`
100145
"
146+
usage: socketcli [-h] [--api-token <token>] [--repo <owner/repo>]
147+
[--repo-is-public] [--branch <name>] [--integration <type>]
148+
[--owner <name>] [--pr-number <number>]
149+
[--commit-message <message>] [--commit-sha <sha>]
150+
[--committers [<name> ...]] [--target-path <path>]
151+
[--sbom-file <path>] [--license-file-name <string>]
152+
[--save-submitted-files-list <path>]
153+
[--save-manifest-tar <path>] [--files <json>]
154+
[--sub-path <path>] [--workspace-name <name>]
155+
[--excluded-ecosystems EXCLUDED_ECOSYSTEMS]
156+
[--default-branch] [--pending-head] [--generate-license]
157+
[--enable-debug] [--enable-json] [--enable-sarif]
158+
[--disable-overview] [--exclude-license-details]
159+
[--allow-unverified] [--disable-security-issue]
160+
[--ignore-commit-files] [--disable-blocking] [--enable-diff]
161+
[--scm <type>] [--timeout <seconds>]
162+
[--include-module-folders] [--version]
163+
socketcli: error: unrecognized arguments: --dry-run --config {"apiToken":"fakeToken"}
101164
_____ _ _ /---------------
102165
| __|___ ___| |_ ___| |_ | CLI: <redacted>
103166
|__ | * | _| '_| -_| _| | token: <redacted>, org: <redacted>

0 commit comments

Comments
 (0)