Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Move isInTestMode to environment.ts
  • Loading branch information
mbg committed May 22, 2026
commit ffebdc8cf857031dc721a97563af99d1b8ace016
8 changes: 5 additions & 3 deletions lib/entry-points.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,12 @@ export enum EnvVar {
/** Used by Code Scanning Risk Assessment to communicate the assessment ID to the CodeQL Action. */
RISK_ASSESSMENT_ID = "CODEQL_ACTION_RISK_ASSESSMENT_ID",
}

/**
* Returns whether we are in test mode. This is used by CodeQL Action PR checks.
*
* In test mode, we skip several uploads (SARIF results, status reports, DBs, ...).
*/
export function isInTestMode(): boolean {
return process.env[EnvVar.TEST_MODE] === "true";
}
13 changes: 3 additions & 10 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import * as apiCompatibility from "./api-compatibility.json";
import type { CodeQL, VersionInfo } from "./codeql";
import type { Pack } from "./config/db-config";
import type { Config } from "./config-utils";
import { EnvVar } from "./environment";
import { EnvVar, isInTestMode } from "./environment";
import * as json from "./json";
import { Language } from "./languages";
import { Logger } from "./logging";

export { isInTestMode } from "./environment";

/**
* The name of the file containing the base database OIDs, as stored in the
* root of the database location.
Expand Down Expand Up @@ -708,15 +710,6 @@ export function isGoodVersion(versionSpec: string) {
return !BROKEN_VERSIONS.includes(versionSpec);
}

/**
* Returns whether we are in test mode. This is used by CodeQL Action PR checks.
*
* In test mode, we skip several uploads (SARIF results, status reports, DBs, ...).
*/
export function isInTestMode(): boolean {
return process.env[EnvVar.TEST_MODE] === "true";
}

/**
* Returns whether we specifically want to skip uploading SARIF files.
*/
Expand Down