From 71350d90ecef886678ddcaea0f43b1407961852a Mon Sep 17 00:00:00 2001 From: Jakob Linskeseder Date: Wed, 18 Mar 2026 19:51:15 +0100 Subject: [PATCH] Don't fail tests if Git is not available I need this because I run Node inside a minimal container for security reasons. --- tasks/tests/git.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/tests/git.test.js b/tasks/tests/git.test.js index fac986ef..78766820 100644 --- a/tasks/tests/git.test.js +++ b/tasks/tests/git.test.js @@ -1,6 +1,7 @@ const os = require('os'); const path = require('path'); const fs = require('fs-extra'); +const { spawnSync } = require('child_process'); const git = require('../util/git'); @@ -9,8 +10,9 @@ const tmpDir = path.join(tmpBaseDir, Date.now().toString(36)); const remoteDir = path.join(tmpDir, 'remote-repo'); const cloneDir = path.join(tmpDir, 'clone-repo'); const oldCwd = process.cwd(); +const gitInstalled = spawnSync('git', ['-v'], { stdio: 'ignore' }).status === 0; -describe('utils/git', function () { +describe.runIf(gitInstalled)('utils/git', function () { beforeEach(async function () { await fs.remove(tmpDir); await createRepositoryThatActsAsRemote();