Skip to content

Commit b872bf9

Browse files
committed
test: Add test to verify 'main' exits with an error when 'GITHUB_REPOSITORY' is missing
1 parent 5804f04 commit b872bf9

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

tests/main-missing-repository.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Verify `main` exits with an error when `GITHUB_REPOSITORY` is missing.
2+
// @ts-check
3+
4+
delete process.env.GITHUB_REPOSITORY;
5+
6+
(async () => {
7+
try {
8+
await import("../main.js");
9+
} catch (error) {
10+
console.error(error.message);
11+
}
12+
})();

tests/snapshots/index.js.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ The actual snapshot is saved in `index.js.snap`.
44

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

7+
## main-missing-repository.test.js
8+
9+
> stderr
10+
11+
'GITHUB_REPOSITORY missing, must be set to \'<owner>/<repo>\''
12+
13+
> stdout
14+
15+
''
16+
717
## post-token-set.test.js
818

919
> stderr

tests/snapshots/index.js.snap

88 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)