From 9e83fa020d453d896229dcb53cc03cc03886b624 Mon Sep 17 00:00:00 2001 From: Gregor Martynus <39992+gr2m@users.noreply.github.com> Date: Wed, 20 Jan 2021 12:31:28 -0800 Subject: [PATCH] WIP ignore GitHub Action related environment variables, and fix "Use the repository URL as is if none of the given git credentials are valid" which should never have passed before but well here we are --- test/integration.test.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/integration.test.js b/test/integration.test.js index 8939f220..be93b749 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -35,10 +35,21 @@ const env = { GH_TOKEN: gitbox.gitCredential, GITHUB_URL: mockServer.url, GITHUB_EVENT_NAME: 'push', - GITHUB_REF: 'master', - GITHUB_EVENT_PATH: '', - GITHUB_ACTION: '' + GITHUB_REF: 'master' }; + +// ignore certain environment variables that are set on CI and that would +// interfere with our test setup +const { + GITHUB_URL, + GITHUB_EVENT_NAME, + GITHUB_REF, + GITHUB_EVENT_PATH, + GITHUB_ACTION, + GITHUB_TOKEN, + ...processEnv +} = process.env + // Environment variables used only for the local npm command used to do verification const testEnv = { ...process.env, @@ -680,7 +691,7 @@ test('Use the valid git credentials when multiple are provided', async (t) => { test('Use the repository URL as is if none of the given git credentials are valid', async (t) => { const {cwd} = await gitbox.createRepo('test-invalid-auth'); - const dummyUrl = 'http://toto@localhost:2080/git/test-auth.git'; + const dummyUrl = 'http://toto@localhost:2080/git/test-invalid-auth.git'; t.is( await getAuthUrl({