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
coverage
node_modules/
+2 -1
View File
@@ -100,6 +100,7 @@ export async function main(
authorization: `bearer ${appAuthentication.token}`,
},
}).catch((error) => {
/* c8 ignore next */
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
@@ -122,7 +123,7 @@ export async function main(
core.setSecret(authentication.token);
core.setOutput("token", authentication.token);
// Make token accessible to post function (so we can invalidate it)
if (!skipTokenRevoke) {
core.saveState("token", authentication.token);
+1
View File
@@ -33,6 +33,7 @@ main(
}),
skipTokenRevoke
).catch((error) => {
/* c8 ignore next 3 */
console.error(error);
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",
"scripts": {
"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",
"dependencies": {
@@ -16,9 +18,11 @@
},
"devDependencies": {
"ava": "^5.3.1",
"c8": "^8.0.1",
"dotenv": "^16.3.1",
"esbuild": "^0.19.4",
"execa": "^8.0.1",
"open-cli": "^7.2.0",
"undici": "^5.25.2"
},
"release": {
+1
View File
@@ -11,6 +11,7 @@ post(
baseUrl: process.env["GITHUB_API_URL"],
})
).catch((error) => {
/* c8 ignore next 3 */
console.error(error);
core.setFailed(error.message);
});