Content-Length: 373793 | pFad | http://github.com/github/codeql-action/commit/b37e7e2c5d1accb39e8977d6ff3c81eb46b15973

F8 Move initializeFeatures() to testing-utils · github/codeql-action@b37e7e2 · GitHub
Skip to content

Commit b37e7e2

Browse files
committed
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.
1 parent 90d7727 commit b37e7e2

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/feature-flags.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { getRunnerLogger } from "./logging";
1515
import { parseRepositoryNwo } from "./repository";
1616
import {
1717
getRecordingLogger,
18+
initializeFeatures,
1819
LoggedMessage,
1920
mockCodeQLVersion,
2021
mockFeatureFlagApiEndpoint,
@@ -552,13 +553,6 @@ function assertAllFeaturesUndefinedInApi(
552553
}
553554
}
554555

555-
export function initializeFeatures(initialValue: boolean) {
556-
return Object.keys(featureConfig).reduce((features, key) => {
557-
features[key] = initialValue;
558-
return features;
559-
}, {});
560-
}
561-
562556
function setUpFeatureFlagTests(
563557
tmpDir: string,
564558
logger = getRunnerLogger(true),

src/setup-codeql.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as sinon from "sinon";
55

66
import * as actionsUtil from "./actions-util";
77
import { Feature, FeatureEnablement } from "./feature-flags";
8-
import { initializeFeatures } from "./feature-flags.test";
98
import { getRunnerLogger } from "./logging";
109
import * as setupCodeql from "./setup-codeql";
1110
import {
@@ -14,6 +13,7 @@ import {
1413
SAMPLE_DEFAULT_CLI_VERSION,
1514
SAMPLE_DOTCOM_API_DETAILS,
1615
getRecordingLogger,
16+
initializeFeatures,
1717
mockBundleDownloadApi,
1818
setupActionsVars,
1919
setupTests,

src/testing-utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as defaults from "./defaults.json";
1414
import {
1515
CodeQLDefaultVersionInfo,
1616
Feature,
17+
featureConfig,
1718
FeatureEnablement,
1819
} from "./feature-flags";
1920
import { Logger } from "./logging";
@@ -263,6 +264,13 @@ export function createFeatures(enabledFeatures: Feature[]): FeatureEnablement {
263264
};
264265
}
265266

267+
export function initializeFeatures(initialValue: boolean) {
268+
return Object.keys(featureConfig).reduce((features, key) => {
269+
features[key] = initialValue;
270+
return features;
271+
}, {});
272+
}
273+
266274
/**
267275
* Mocks the API for downloading the bundle tagged `tagName`.
268276
*

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/github/codeql-action/commit/b37e7e2c5d1accb39e8977d6ff3c81eb46b15973

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy