Add regression test
This commit is contained in:
parent
b07135c4b8
commit
1f4b0cb523
6 changed files with 20 additions and 3 deletions
1
lib/setup-codeql.js
generated
1
lib/setup-codeql.js
generated
|
|
@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.downloadCodeQL = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = exports.ToolsSource = void 0;
|
exports.downloadCodeQL = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = exports.ToolsSource = void 0;
|
||||||
exports.getCodeQLActionRepository = getCodeQLActionRepository;
|
exports.getCodeQLActionRepository = getCodeQLActionRepository;
|
||||||
|
exports.tryGetTagNameFromUrl = tryGetTagNameFromUrl;
|
||||||
exports.tryGetBundleVersionFromUrl = tryGetBundleVersionFromUrl;
|
exports.tryGetBundleVersionFromUrl = tryGetBundleVersionFromUrl;
|
||||||
exports.convertToSemVer = convertToSemVer;
|
exports.convertToSemVer = convertToSemVer;
|
||||||
exports.getCodeQLSource = getCodeQLSource;
|
exports.getCodeQLSource = getCodeQLSource;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
3
lib/setup-codeql.test.js
generated
3
lib/setup-codeql.test.js
generated
|
|
@ -168,4 +168,7 @@ ava_1.default.beforeEach(() => {
|
||||||
msg.message.includes(expected_message)));
|
msg.message.includes(expected_message)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
(0, ava_1.default)('tryGetTagNameFromUrl extracts the right tag name for a repo name containing "codeql-bundle"', (t) => {
|
||||||
|
t.is(setupCodeql.tryGetTagNameFromUrl("https://github.com/org/codeql-bundle-testing/releases/download/codeql-bundle-v2.19.0/codeql-bundle-linux64.tar.zst", (0, logging_1.getRunnerLogger)(true)), "codeql-bundle-v2.19.0");
|
||||||
|
});
|
||||||
//# sourceMappingURL=setup-codeql.test.js.map
|
//# sourceMappingURL=setup-codeql.test.js.map
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -249,3 +249,13 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('tryGetTagNameFromUrl extracts the right tag name for a repo name containing "codeql-bundle"', (t) => {
|
||||||
|
t.is(
|
||||||
|
setupCodeql.tryGetTagNameFromUrl(
|
||||||
|
"https://github.com/org/codeql-bundle-testing/releases/download/codeql-bundle-v2.19.0/codeql-bundle-linux64.tar.zst",
|
||||||
|
getRunnerLogger(true),
|
||||||
|
),
|
||||||
|
"codeql-bundle-v2.19.0",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,10 @@ function tryGetBundleVersionFromTagName(
|
||||||
return match[1];
|
return match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryGetTagNameFromUrl(url: string, logger: Logger): string | undefined {
|
export function tryGetTagNameFromUrl(
|
||||||
|
url: string,
|
||||||
|
logger: Logger,
|
||||||
|
): string | undefined {
|
||||||
const matches = [...url.matchAll(/\/(codeql-bundle-[^/]*)\//g)];
|
const matches = [...url.matchAll(/\/(codeql-bundle-[^/]*)\//g)];
|
||||||
if (!matches.length) {
|
if (!matches.length) {
|
||||||
logger.debug(`Could not determine tag name for URL ${url}.`);
|
logger.debug(`Could not determine tag name for URL ${url}.`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue