Skip to content

Commit

Permalink
test: Add test to verify 'main' exits with an error when 'GITHUB_REPO…
Browse files Browse the repository at this point in the history
…SITORY' is missing
  • Loading branch information
smockle committed Oct 3, 2023
1 parent 5804f04 commit b872bf9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/main-missing-repository.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Verify `main` exits with an error when `GITHUB_REPOSITORY` is missing.
// @ts-check

delete process.env.GITHUB_REPOSITORY;

(async () => {
try {
await import("../main.js");
} catch (error) {
console.error(error.message);
}
})();
10 changes: 10 additions & 0 deletions tests/snapshots/index.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ The actual snapshot is saved in `index.js.snap`.

Generated by [AVA](https://avajs.dev).

## main-missing-repository.test.js

> stderr
'GITHUB_REPOSITORY missing, must be set to \'<owner>/<repo>\''

> stdout
''

## post-token-set.test.js

> stderr
Expand Down
Binary file modified tests/snapshots/index.js.snap
Binary file not shown.

0 comments on commit b872bf9

Please sign in to comment.