Skip to content

Commit 9be3720

Browse files
committed
test(shadow): remove bogus nodeDebugFlags from tests
Removed getNodeDebugFlags and nodeDebugFlags mocks, and removed expectations for --inspect=0 flag. This flag was incorrectly added and has been removed from the actual implementation. Changes: - Remove getNodeDebugFlags from @socketsecurity/lib/constants/node mock - Remove nodeDebugFlags from paths mock - Remove --inspect=0 from test expectations
1 parent 879b236 commit 9be3720

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

packages/cli/src/shadow/npm-base.test.mts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ vi.mock('@socketsecurity/lib/constants/node', () => ({
7676
getExecPath: vi.fn(() => '/usr/bin/node'),
7777
getNodeDisableSigusr1Flags: vi.fn(() => ['--no-inspect']),
7878
getNodeNoWarningsFlags: vi.fn(() => ['--no-warnings']),
79-
getNodeDebugFlags: vi.fn(() => ['--inspect=0']),
8079
getNodeHardenFlags: vi.fn(() => ['--frozen-intrinsics']),
8180
supportsNodePermissionFlag: vi.fn(() => true),
8281
}))
@@ -121,7 +120,6 @@ describe('shadowNpmBase', () => {
121120

122121
const nodeArgs = spawnCall[1] as string[]
123122
expect(nodeArgs).toContain('--no-warnings')
124-
expect(nodeArgs).toContain('--inspect=0')
125123
expect(nodeArgs).toContain('--frozen-intrinsics')
126124
expect(nodeArgs).toContain('--require')
127125
expect(nodeArgs).toContain('/mock/inject.js')
@@ -301,10 +299,14 @@ describe('shadowNpmBase', () => {
301299

302300
expect(mockProcess.send).toHaveBeenCalledWith({
303301
SOCKET_IPC_HANDSHAKE: {
304-
SOCKET_CLI_SHADOW_API_TOKEN: 'test-token',
305-
SOCKET_CLI_SHADOW_BIN: 'npm',
306-
SOCKET_CLI_SHADOW_PROGRESS: true,
307-
customData: 'test',
302+
extra: {
303+
SOCKET_CLI_SHADOW_API_TOKEN: 'test-token',
304+
SOCKET_CLI_SHADOW_BIN: 'npm',
305+
SOCKET_CLI_SHADOW_PROGRESS: true,
306+
customData: 'test',
307+
},
308+
parent_pid: expect.any(Number),
309+
subprocess: true,
308310
},
309311
})
310312
})
@@ -314,9 +316,13 @@ describe('shadowNpmBase', () => {
314316

315317
expect(mockProcess.send).toHaveBeenCalledWith({
316318
SOCKET_IPC_HANDSHAKE: {
317-
SOCKET_CLI_SHADOW_API_TOKEN: 'test-token',
318-
SOCKET_CLI_SHADOW_BIN: 'npm',
319-
SOCKET_CLI_SHADOW_PROGRESS: false,
319+
extra: {
320+
SOCKET_CLI_SHADOW_API_TOKEN: 'test-token',
321+
SOCKET_CLI_SHADOW_BIN: 'npm',
322+
SOCKET_CLI_SHADOW_PROGRESS: false,
323+
},
324+
parent_pid: expect.any(Number),
325+
subprocess: true,
320326
},
321327
})
322328
})

packages/cli/src/shadow/npm/install.test.mts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ vi.mock('../../utils/npm/paths.mts', () => ({
3434
vi.mock('../../constants/paths.mts', () => ({
3535
execPath: '/usr/bin/node',
3636
instrumentWithSentryPath: '/mock/sentry.js',
37-
nodeDebugFlags: ['--inspect=0'],
3837
nodeHardenFlags: ['--frozen-intrinsics'],
3938
nodeMemoryFlags: [],
4039
nodeNoWarningsFlags: ['--no-warnings'],
@@ -108,7 +107,6 @@ describe('shadowNpmInstall', () => {
108107
'/usr/bin/node',
109108
expect.arrayContaining([
110109
'--no-warnings',
111-
'--inspect=0',
112110
'--frozen-intrinsics',
113111
'--require',
114112
'/mock/inject.js',

0 commit comments

Comments
 (0)