test: add coverage (#58)

This commit is contained in:
Gregor Martynus
2023-10-06 12:54:48 -07:00
committed by GitHub
parent 9b283559f1
commit bdb2377ad0
6 changed files with 1684 additions and 5 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
node_modules/
.env .env
coverage
node_modules/
+1
View File
@@ -100,6 +100,7 @@ export async function main(
authorization: `bearer ${appAuthentication.token}`, authorization: `bearer ${appAuthentication.token}`,
}, },
}).catch((error) => { }).catch((error) => {
/* c8 ignore next */
if (error.status !== 404) throw error; if (error.status !== 404) throw error;
// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app // https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app
+1
View File
@@ -33,6 +33,7 @@ main(
}), }),
skipTokenRevoke skipTokenRevoke
).catch((error) => { ).catch((error) => {
/* c8 ignore next 3 */
console.error(error); console.error(error);
core.setFailed(error.message); core.setFailed(error.message);
}); });
+1673 -2
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -6,7 +6,9 @@
"description": "GitHub Action for creating a GitHub App Installation Access Token", "description": "GitHub Action for creating a GitHub App Installation Access Token",
"scripts": { "scripts": {
"build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node16.16", "build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node16.16",
"test": "ava tests/index.js" "test": "c8 --100 ava tests/index.js",
"coverage": "c8 report --reporter html",
"postcoverage": "open-cli coverage/index.html"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -16,9 +18,11 @@
}, },
"devDependencies": { "devDependencies": {
"ava": "^5.3.1", "ava": "^5.3.1",
"c8": "^8.0.1",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"esbuild": "^0.19.4", "esbuild": "^0.19.4",
"execa": "^8.0.1", "execa": "^8.0.1",
"open-cli": "^7.2.0",
"undici": "^5.25.2" "undici": "^5.25.2"
}, },
"release": { "release": {
+1
View File
@@ -11,6 +11,7 @@ post(
baseUrl: process.env["GITHUB_API_URL"], baseUrl: process.env["GITHUB_API_URL"],
}) })
).catch((error) => { ).catch((error) => {
/* c8 ignore next 3 */
console.error(error); console.error(error);
core.setFailed(error.message); core.setFailed(error.message);
}); });