Skip to content

Commit a940b41

Browse files
committed
better error messages when socket fix e2e tests fail
1 parent 51af61b commit a940b41

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/commands/fix/cmd-fix-e2e.test.mts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,17 @@ describe('socket fix (E2E tests)', async () => {
204204
'socket-fix-output.json',
205205
)
206206

207-
const { code } = await spawnSocketCli(binCliPath, cmd, {
207+
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd, {
208208
cwd: tempFixture.path,
209209
env: getTestEnv(apiToken),
210210
})
211211

212+
if (code !== 0) {
213+
logger.error(`Command failed with code ${code}`)
214+
logger.error('stdout:', stdout)
215+
logger.error('stderr:', stderr)
216+
}
217+
212218
expect(code, 'should exit with code 0').toBe(0)
213219

214220
const afterPkg = await readPackageJson(tempFixture.path)
@@ -264,11 +270,17 @@ describe('socket fix (E2E tests)', async () => {
264270

265271
expect(beforeLodashVersion).toBe('4.17.20')
266272

267-
const { code } = await spawnSocketCli(binCliPath, cmd, {
273+
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd, {
268274
cwd: tempFixture.path,
269275
env: getTestEnv(apiToken),
270276
})
271277

278+
if (code !== 0) {
279+
logger.error(`Command failed with code ${code}`)
280+
logger.error('stdout:', stdout)
281+
logger.error('stderr:', stderr)
282+
}
283+
272284
expect(code, 'should exit with code 0').toBe(0)
273285

274286
const afterPkg = await readPackageJson(tempFixture.path)
@@ -307,11 +319,17 @@ describe('socket fix (E2E tests)', async () => {
307319

308320
expect(beforeLodashVersion).toBe('4.17.20')
309321

310-
const { code } = await spawnSocketCli(binCliPath, cmd, {
322+
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd, {
311323
cwd: tempFixture.path,
312324
env: getTestEnv(apiToken),
313325
})
314326

327+
if (code !== 0) {
328+
logger.error(`Command failed with code ${code}`)
329+
logger.error('stdout:', stdout)
330+
logger.error('stderr:', stderr)
331+
}
332+
315333
expect(code, 'should exit with code 0').toBe(0)
316334

317335
const afterPkg = await readPackageJson(tempFixture.path)
@@ -355,11 +373,17 @@ describe('socket fix (E2E tests)', async () => {
355373
expect(beforeDjango).toBeDefined()
356374
expect(beforeDjango).toContain('3.0.0')
357375

358-
const { code } = await spawnSocketCli(binCliPath, cmd, {
376+
const { code, stderr, stdout } = await spawnSocketCli(binCliPath, cmd, {
359377
cwd: tempFixture.path,
360378
env: getTestEnv(apiToken),
361379
})
362380

381+
if (code !== 0) {
382+
logger.error(`Command failed with code ${code}`)
383+
logger.error('stdout:', stdout)
384+
logger.error('stderr:', stderr)
385+
}
386+
363387
expect(code, 'should exit with code 0').toBe(0)
364388

365389
const afterReqs = await readRequirementsTxt(tempFixture.path)

0 commit comments

Comments
 (0)