mirror of
https://github.com/github/codeql-action.git
synced 2026-04-17 04:23:16 +00:00
Move initializeFeatures() to testing-utils
This change eliminates the need for setup-codeql.test to import from feature-flags.test, which makes the former run all tests defined in the latter.
This commit is contained in:
@@ -15,6 +15,7 @@ import { getRunnerLogger } from "./logging";
|
||||
import { parseRepositoryNwo } from "./repository";
|
||||
import {
|
||||
getRecordingLogger,
|
||||
initializeFeatures,
|
||||
LoggedMessage,
|
||||
mockCodeQLVersion,
|
||||
mockFeatureFlagApiEndpoint,
|
||||
@@ -552,13 +553,6 @@ function assertAllFeaturesUndefinedInApi(
|
||||
}
|
||||
}
|
||||
|
||||
export function initializeFeatures(initialValue: boolean) {
|
||||
return Object.keys(featureConfig).reduce((features, key) => {
|
||||
features[key] = initialValue;
|
||||
return features;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function setUpFeatureFlagTests(
|
||||
tmpDir: string,
|
||||
logger = getRunnerLogger(true),
|
||||
|
||||
@@ -5,7 +5,6 @@ import * as sinon from "sinon";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||
import { initializeFeatures } from "./feature-flags.test";
|
||||
import { getRunnerLogger } from "./logging";
|
||||
import * as setupCodeql from "./setup-codeql";
|
||||
import {
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
SAMPLE_DEFAULT_CLI_VERSION,
|
||||
SAMPLE_DOTCOM_API_DETAILS,
|
||||
getRecordingLogger,
|
||||
initializeFeatures,
|
||||
mockBundleDownloadApi,
|
||||
setupActionsVars,
|
||||
setupTests,
|
||||
|
||||
@@ -14,6 +14,7 @@ import * as defaults from "./defaults.json";
|
||||
import {
|
||||
CodeQLDefaultVersionInfo,
|
||||
Feature,
|
||||
featureConfig,
|
||||
FeatureEnablement,
|
||||
} from "./feature-flags";
|
||||
import { Logger } from "./logging";
|
||||
@@ -263,6 +264,13 @@ export function createFeatures(enabledFeatures: Feature[]): FeatureEnablement {
|
||||
};
|
||||
}
|
||||
|
||||
export function initializeFeatures(initialValue: boolean) {
|
||||
return Object.keys(featureConfig).reduce((features, key) => {
|
||||
features[key] = initialValue;
|
||||
return features;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mocks the API for downloading the bundle tagged `tagName`.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user