Remove unnecessary env manipulation

testing-utils.ts / setupTests() already stores and restores the env
This commit is contained in:
Simon Engledew 2020-11-04 10:59:31 +00:00
parent 5c0e2f93f1
commit 1c8d72e0c2
No known key found for this signature in database
GPG key ID: 84302E7B02FE8BCE
6 changed files with 2 additions and 20 deletions

View file

@ -34,8 +34,6 @@ test("getRef() returns head PR ref if GITHUB_SHA not currently checked out", asy
});
test("getAnalysisKey() when a local run", async (t) => {
const origLocalRun = process.env.CODEQL_LOCAL_RUN;
process.env.CODEQL_LOCAL_RUN = "true";
process.env.CODEQL_ACTION_ANALYSIS_KEY = "";
process.env.GITHUB_JOB = "";
@ -45,13 +43,9 @@ test("getAnalysisKey() when a local run", async (t) => {
const actualAnalysisKey = await actionsutil.getAnalysisKey();
t.deepEqual(actualAnalysisKey, "LOCAL-RUN:UNKNOWN-JOB");
process.env.CODEQL_LOCAL_RUN = origLocalRun;
});
test("prepareEnvironment() when a local run", (t) => {
const origLocalRun = process.env.CODEQL_LOCAL_RUN;
process.env.CODEQL_LOCAL_RUN = "false";
process.env.GITHUB_JOB = "YYY";
process.env.CODEQL_ACTION_ANALYSIS_KEY = "TEST";
@ -86,6 +80,4 @@ test("prepareEnvironment() when a local run", (t) => {
// updated
t.deepEqual(process.env.GITHUB_JOB, "UNKNOWN-JOB");
t.deepEqual(process.env.CODEQL_ACTION_ANALYSIS_KEY, "LOCAL-RUN:UNKNOWN-JOB");
process.env.CODEQL_LOCAL_RUN = origLocalRun;
});

View file

@ -72,8 +72,6 @@ test("getThreadsFlag() throws if the threads input is not an integer", (t) => {
});
test("isLocalRun() runs correctly", (t) => {
const origLocalRun = process.env.CODEQL_LOCAL_RUN;
process.env.CODEQL_LOCAL_RUN = "";
t.assert(!util.isLocalRun());
@ -88,8 +86,6 @@ test("isLocalRun() runs correctly", (t) => {
process.env.CODEQL_LOCAL_RUN = "hucairz";
t.assert(util.isLocalRun());
process.env.CODEQL_LOCAL_RUN = origLocalRun;
});
test("getExtraOptionsEnvParam() succeeds on valid JSON with invalid options (for now)", (t) => {