Skip to content

Commit 32add9c

Browse files
committed
fix silence bug. debug output to e2e reachability tests
1 parent 8f870e4 commit 32add9c

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

src/commands/fix/handle-fix.mts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ export async function convertIdsToGhsas(
3737
ids: string[],
3838
options?: ConvertIdsOptions | undefined,
3939
): Promise<string[]> {
40-
const { silence = false } = { __proto__: null, ...options } as ConvertIdsOptions
40+
const { silence = false } = {
41+
__proto__: null,
42+
...options,
43+
} as ConvertIdsOptions
4144
debugFn('notice', `Converting ${ids.length} IDs to GHSA format`)
4245
debugDir('inspect', { ids })
4346

@@ -96,9 +99,11 @@ export async function convertIdsToGhsas(
9699
}
97100

98101
if (errors.length) {
99-
logger.warn(
100-
`Skipped ${errors.length} invalid IDs:\n${errors.map(e => ` - ${e}`).join('\n')}`,
101-
)
102+
if (!silence) {
103+
logger.warn(
104+
`Skipped ${errors.length} invalid IDs:\n${errors.map(e => ` - ${e}`).join('\n')}`,
105+
)
106+
}
102107
debugDir('inspect', { errors })
103108
}
104109

src/commands/scan/cmd-scan-reach.e2e.test.mts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,14 @@ describe('socket scan reach (E2E tests)', async () => {
246246

247247
describe('npm-test-workspace-mono', () => {
248248
cmdit(
249-
['scan', 'reach', '.', '--no-interactive', '--reach-disable-analytics'],
249+
[
250+
'scan',
251+
'reach',
252+
'.',
253+
'--reach-debug',
254+
'--no-interactive',
255+
'--reach-disable-analytics',
256+
],
250257
'should run reachability analysis on workspace mono project',
251258
async cmd => {
252259
const tempFixture = await createTempFixtureCopy(
@@ -395,6 +402,7 @@ describe('socket scan reach (E2E tests)', async () => {
395402
'scan',
396403
'reach',
397404
'.',
405+
'--reach-debug',
398406
'--no-interactive',
399407
'--reach-disable-analytics',
400408
'--reach-exclude-paths',
@@ -493,6 +501,7 @@ describe('socket scan reach (E2E tests)', async () => {
493501
'scan',
494502
'reach',
495503
'packages/package-a',
504+
'--reach-debug',
496505
'--no-interactive',
497506
'--reach-disable-analytics',
498507
],
@@ -598,7 +607,14 @@ describe('socket scan reach (E2E tests)', async () => {
598607
)
599608

600609
cmdit(
601-
['scan', 'reach', '.', '--no-interactive', '--reach-disable-analytics'],
610+
[
611+
'scan',
612+
'reach',
613+
'.',
614+
'--reach-debug',
615+
'--no-interactive',
616+
'--reach-disable-analytics',
617+
],
602618
'should use --cwd to set the working directory',
603619
async cmd => {
604620
const tempFixture = await createTempFixtureCopy(
@@ -673,6 +689,7 @@ describe('socket scan reach (E2E tests)', async () => {
673689
'scan',
674690
'reach',
675691
'packages/package-b',
692+
'--reach-debug',
676693
'--no-interactive',
677694
'--reach-disable-analytics',
678695
],
@@ -770,6 +787,7 @@ describe('socket scan reach (E2E tests)', async () => {
770787
'scan',
771788
'reach',
772789
'../outside-dir',
790+
'--reach-debug',
773791
'--no-interactive',
774792
'--reach-disable-analytics',
775793
],
@@ -822,7 +840,14 @@ describe('socket scan reach (E2E tests)', async () => {
822840
)
823841

824842
cmdit(
825-
['scan', 'reach', '.', '--no-interactive', '--reach-disable-analytics'],
843+
[
844+
'scan',
845+
'reach',
846+
'.',
847+
'--reach-debug',
848+
'--no-interactive',
849+
'--reach-disable-analytics',
850+
],
826851
'should write output to cwd when running from subdirectory',
827852
async cmd => {
828853
const tempFixture = await createTempFixtureCopy(
@@ -908,6 +933,7 @@ describe('socket scan reach (E2E tests)', async () => {
908933
'scan',
909934
'reach',
910935
'.',
936+
'--reach-debug',
911937
'--no-interactive',
912938
'--reach-ecosystems',
913939
'pypi',
@@ -1009,6 +1035,7 @@ describe('socket scan reach (E2E tests)', async () => {
10091035
'scan',
10101036
'reach',
10111037
'.',
1038+
'--reach-debug',
10121039
'--no-interactive',
10131040
'--reach-ecosystems',
10141041
'npm',

0 commit comments

Comments
 (0)