mirror of
https://github.com/github/codeql-action.git
synced 2026-11-05 04:29:40 +00:00
Deprecate isInTestMode in favour of a more clearly named method
This commit is contained in:
11
lib/entry-points.js
generated
11
lib/entry-points.js
generated
@@ -166145,6 +166145,15 @@ var ReadOnlyEnv = class {
|
||||
entries() {
|
||||
return Object.entries(this.vars);
|
||||
}
|
||||
/**
|
||||
* Gets a value indicating whether we should skip uploads of
|
||||
* all kinds (SARIF results, status reports, DBs, ...).
|
||||
*
|
||||
* This is not guaranteed to be set in all test environments.
|
||||
*/
|
||||
isSkippingUploadsInTests() {
|
||||
return this.getOptional("CODEQL_ACTION_TEST_MODE" /* TEST_MODE */) === "true";
|
||||
}
|
||||
/**
|
||||
* Gets a value indicative of whether we are in a testing environment
|
||||
* by testing whether the value of the `NODE_ENV` variable is "test".
|
||||
@@ -166185,7 +166194,7 @@ function getEnv(env = process.env) {
|
||||
return new Env(env);
|
||||
}
|
||||
function isInTestMode() {
|
||||
return process.env["CODEQL_ACTION_TEST_MODE" /* TEST_MODE */] === "true";
|
||||
return getEnv().isSkippingUploadsInTests();
|
||||
}
|
||||
function exportVariable2(name, val) {
|
||||
const env = getEnv();
|
||||
|
||||
@@ -304,6 +304,16 @@ export class ReadOnlyEnv<T extends string | undefined = string | undefined> {
|
||||
return Object.entries(this.vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether we should skip uploads of
|
||||
* all kinds (SARIF results, status reports, DBs, ...).
|
||||
*
|
||||
* This is not guaranteed to be set in all test environments.
|
||||
*/
|
||||
public isSkippingUploadsInTests(): boolean {
|
||||
return this.getOptional(EnvVar.TEST_MODE) === "true";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicative of whether we are in a testing environment
|
||||
* by testing whether the value of the `NODE_ENV` variable is "test".
|
||||
@@ -366,9 +376,14 @@ export function getEnv(env: NodeJS.ProcessEnv = process.env): Env {
|
||||
* 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, ...).
|
||||
*
|
||||
* @deprecated
|
||||
* The purpose of this function is ambiguous. Use `isSkippingUploadsInTests` on
|
||||
* a `ReadOnlyEnv` instance instead for equivalent behaviour. Use `isTestingEnv`
|
||||
* to determine if we are running in a unit test.
|
||||
*/
|
||||
export function isInTestMode(): boolean {
|
||||
return process.env[EnvVar.TEST_MODE] === "true";
|
||||
return getEnv().isSkippingUploadsInTests();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user