Skip to content

Commit ffebdc8

Browse files
committed
Move isInTestMode to environment.ts
1 parent 0fb8a66 commit ffebdc8

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

lib/entry-points.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/environment.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,12 @@ export enum EnvVar {
154154
/** Used by Code Scanning Risk Assessment to communicate the assessment ID to the CodeQL Action. */
155155
RISK_ASSESSMENT_ID = "CODEQL_ACTION_RISK_ASSESSMENT_ID",
156156
}
157+
158+
/**
159+
* Returns whether we are in test mode. This is used by CodeQL Action PR checks.
160+
*
161+
* In test mode, we skip several uploads (SARIF results, status reports, DBs, ...).
162+
*/
163+
export function isInTestMode(): boolean {
164+
return process.env[EnvVar.TEST_MODE] === "true";
165+
}

src/util.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ import * as apiCompatibility from "./api-compatibility.json";
1313
import type { CodeQL, VersionInfo } from "./codeql";
1414
import type { Pack } from "./config/db-config";
1515
import type { Config } from "./config-utils";
16-
import { EnvVar } from "./environment";
16+
import { EnvVar, isInTestMode } from "./environment";
1717
import * as json from "./json";
1818
import { Language } from "./languages";
1919
import { Logger } from "./logging";
2020

21+
export { isInTestMode } from "./environment";
22+
2123
/**
2224
* The name of the file containing the base database OIDs, as stored in the
2325
* root of the database location.
@@ -708,15 +710,6 @@ export function isGoodVersion(versionSpec: string) {
708710
return !BROKEN_VERSIONS.includes(versionSpec);
709711
}
710712

711-
/**
712-
* Returns whether we are in test mode. This is used by CodeQL Action PR checks.
713-
*
714-
* In test mode, we skip several uploads (SARIF results, status reports, DBs, ...).
715-
*/
716-
export function isInTestMode(): boolean {
717-
return process.env[EnvVar.TEST_MODE] === "true";
718-
}
719-
720713
/**
721714
* Returns whether we specifically want to skip uploading SARIF files.
722715
*/

0 commit comments

Comments
 (0)