From 3d2cabb3ce866ae46e81227ced2fb7b7cdc3b868 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Thu, 29 Feb 2024 16:04:58 +0100
Subject: [PATCH] test: fix jest wrapper (#27636)

---
 test/exec-util.ts | 2 ++
 tools/jest.mjs    | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/exec-util.ts b/test/exec-util.ts
index 9b73c3079f..4fd8870092 100644
--- a/test/exec-util.ts
+++ b/test/exec-util.ts
@@ -31,6 +31,8 @@ function execSnapshot(cmd: string, options?: RawExecOptions): ExecSnapshot {
     if (is.string(v)) {
       const val = v
         .replace(regEx(/\\(\w)/g), '/$1')
+        .replace(regEx(/^[A-Z]:\//), '/') // replace windows paths
+        .replace(regEx(/"[A-Z]:\//g), '"/') // replace windows paths
         .replace(cwd, '/root/project');
       this.update(val);
     }
diff --git a/tools/jest.mjs b/tools/jest.mjs
index 232e249657..914cf82b36 100644
--- a/tools/jest.mjs
+++ b/tools/jest.mjs
@@ -25,4 +25,8 @@ args.push('node_modules/jest/bin/jest.js', '--logHeapUsage');
 // add other args after `node tools/jest.mjs`
 args.push(...argv.slice(2));
 
-spawnSync('node', args, { stdio: 'inherit', env });
+const res = spawnSync('node', args, { stdio: 'inherit', env });
+
+if (res.status !== null && res.status !== 0) {
+  process.exit(res.status);
+}
-- 
GitLab