Fix compile errors introduced by typescript 4.4.2
4.4.2 introduces a breaking change that the variable in a catch clause is now `unknown` type. So, we need to cast the `e`, `err`, or `error` variables to type `Error`.
This commit is contained in:
parent
5b28adb7ed
commit
40568daca8
83 changed files with 601 additions and 576 deletions
20
lib/upload-lib.test.js
generated
20
lib/upload-lib.test.js
generated
|
|
@ -29,19 +29,19 @@ const logging_1 = require("./logging");
|
|||
const testing_utils_1 = require("./testing-utils");
|
||||
const uploadLib = __importStar(require("./upload-lib"));
|
||||
const util_1 = require("./util");
|
||||
testing_utils_1.setupTests(ava_1.default);
|
||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||
ava_1.default.beforeEach(() => {
|
||||
util_1.initializeEnvironment(util_1.Mode.actions, "1.2.3");
|
||||
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
||||
});
|
||||
ava_1.default("validateSarifFileSchema - valid", (t) => {
|
||||
(0, ava_1.default)("validateSarifFileSchema - valid", (t) => {
|
||||
const inputFile = `${__dirname}/../src/testdata/valid-sarif.sarif`;
|
||||
t.notThrows(() => uploadLib.validateSarifFileSchema(inputFile, logging_1.getRunnerLogger(true)));
|
||||
t.notThrows(() => uploadLib.validateSarifFileSchema(inputFile, (0, logging_1.getRunnerLogger)(true)));
|
||||
});
|
||||
ava_1.default("validateSarifFileSchema - invalid", (t) => {
|
||||
(0, ava_1.default)("validateSarifFileSchema - invalid", (t) => {
|
||||
const inputFile = `${__dirname}/../src/testdata/invalid-sarif.sarif`;
|
||||
t.throws(() => uploadLib.validateSarifFileSchema(inputFile, logging_1.getRunnerLogger(true)));
|
||||
t.throws(() => uploadLib.validateSarifFileSchema(inputFile, (0, logging_1.getRunnerLogger)(true)));
|
||||
});
|
||||
ava_1.default("validate correct payload used per version", async (t) => {
|
||||
(0, ava_1.default)("validate correct payload used per version", async (t) => {
|
||||
const newVersions = [
|
||||
{ type: util_1.GitHubVariant.DOTCOM },
|
||||
{ type: util_1.GitHubVariant.GHES, version: "3.1.0" },
|
||||
|
|
@ -72,8 +72,8 @@ ava_1.default("validate correct payload used per version", async (t) => {
|
|||
t.falsy(payload.base_sha);
|
||||
}
|
||||
});
|
||||
ava_1.default("finding SARIF files", async (t) => {
|
||||
await util_1.withTmpDir(async (tmpDir) => {
|
||||
(0, ava_1.default)("finding SARIF files", async (t) => {
|
||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
// include a couple of sarif files
|
||||
fs.writeFileSync(path.join(tmpDir, "a.sarif"), "");
|
||||
fs.writeFileSync(path.join(tmpDir, "b.sarif"), "");
|
||||
|
|
@ -97,7 +97,7 @@ ava_1.default("finding SARIF files", async (t) => {
|
|||
]);
|
||||
});
|
||||
});
|
||||
ava_1.default("populateRunAutomationDetails", (t) => {
|
||||
(0, ava_1.default)("populateRunAutomationDetails", (t) => {
|
||||
let sarif = '{"runs": [{}]}';
|
||||
const analysisKey = ".github/workflows/codeql-analysis.yml:analyze";
|
||||
let expectedSarif = '{"runs":[{"automationDetails":{"id":"language:javascript/os:linux/"}}]}';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue