Skip to content

Commit 31fbc88

Browse files
committed
Attempt to fix cdxgen test in Windows
1 parent 86fb0dd commit 31fbc88

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/commands/cdxgen/cmd-cdxgen.test.mts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ describe('socket cdxgen', async () => {
1717
`should support ${FLAG_HELP}`,
1818
async cmd => {
1919
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd)
20-
// cdxgen outputs its version and runtime info when run with help.
21-
expect(stdout).toMatch(/CycloneDX Generator/)
20+
// Note: cdxgen may output version info to stdout or stderr depending on environment.
21+
// In CI environments, stdout might be empty while help text is in stderr.
22+
const hasVersionInStdout = stdout.includes('CycloneDX Generator')
23+
const hasHelpInStderr = stderr.includes('cdxgen [command]')
24+
25+
// The test should pass if we get either the version in stdout OR help in stderr.
26+
expect(hasVersionInStdout || hasHelpInStderr).toBe(true)
2227
expect(code, 'explicit help should exit with code 0').toBe(0)
2328
},
2429
)

0 commit comments

Comments
 (0)