From 147ec49ff57e9f9c7736798e43e865527daf0f30 Mon Sep 17 00:00:00 2001 From: kegsay Date: Tue, 9 Aug 2022 15:22:32 +0100 Subject: [PATCH] cypress: log stdout/stderr when docker exec fails (#9154) Otherwise you cannot debug anything with errors like: ``` > Command failed: docker exec 134c9a0afd7dadd0b82ce69b4d72d3d6d8ca1b211540d4390a88357b68fa03b9 pg_isready -U postgres ``` Now we include the stdout/err prior to logging this. --- cypress/plugins/docker/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cypress/plugins/docker/index.ts b/cypress/plugins/docker/index.ts index 2f3c646408..98f8c2584d 100644 --- a/cypress/plugins/docker/index.ts +++ b/cypress/plugins/docker/index.ts @@ -61,9 +61,14 @@ export function dockerExec(args: { childProcess.execFile("docker", [ "exec", args.containerId, ...args.params, - ], { encoding: 'utf8' }, err => { - if (err) reject(err); - else resolve(); + ], { encoding: 'utf8' }, (err, stdout, stderr) => { + if (err) { + console.log(stdout); + console.log(stderr); + reject(err); + return; + } + resolve(); }); }); }