create-github-app-token/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Parker Brown e85f677b44
test: omit stack traces from snapshots (#401)
The `integration` check fails on `main` because 10 snapshots include
Node.js internal stack frames, and their names changed between Node.js
versions. CI installs the latest Node.js that matches `>=24.4.0`, so
these snapshots can break without any change to the action.

This PR runs each test with `--stack-trace-limit=0`, so error output no
longer includes stack traces. Snapshots still capture the error message,
any HTTP error details, and the `::error::` output users see. Code
coverage is still enforced by `c8 --100`.

Without stack traces, `normalizeStderr` is no longer needed, so this
removes it.

All 120 tests pass with 100% coverage on Node.js 24 and 26.

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: b91f96b7-a7f3-4ff3-8f52-3a617307ede2
2026-10-12 15:35:22 -07:00
..
action-deprecated-inputs.test.js feat: use dash notation for inputs (deprecates underscore notation) (#59) 2023-10-06 13:10:49 -07:00
index.js test: omit stack traces from snapshots (#401) 2026-10-12 15:35:22 -07:00
index.js.snapshot test: omit stack traces from snapshots (#401) 2026-10-12 15:35:22 -07:00
main-app-id-fallback.test.js feat: add client-id input and deprecate app-id (#353) 2026-04-10 17:36:03 -07:00
main-client-id-precedence.test.js feat: add client-id input and deprecate app-id (#353) 2026-04-10 17:36:03 -07:00
main-custom-github-api-url.test.js test: fix test file extensions and inputs for repositories (#161) 2024-09-03 20:04:47 -07:00
main-enterprise-fail-response.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-enterprise-installation-not-found.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-enterprise-mutual-exclusivity-owner.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-enterprise-mutual-exclusivity-repositories.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-enterprise-only-success.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-enterprise-token-permissions-set.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-missing-client-and-app-id.test.js feat: add client-id input and deprecate app-id (#353) 2026-04-10 17:36:03 -07:00
main-missing-owner.test.js test: integration tests for main.js (#56) 2023-10-06 12:39:35 -07:00
main-missing-private-key.test.js fix: validate private-key input (#376) 2026-05-12 16:05:46 -07:00
main-missing-repository.test.js test: integration tests for main.js (#56) 2023-10-06 12:39:35 -07:00
main-private-key-with-escaped-newlines.test.js test: fix test file extensions and inputs for repositories (#161) 2024-09-03 20:04:47 -07:00
main-proxy-requires-native-support.test.js fix!: require NODE_USE_ENV_PROXY for proxy support (#342) 2026-03-13 17:21:42 -07:00
main-repo-skew.test.js test: migrate from AVA to Node.js native test runner (#346) 2026-03-13 17:21:42 -07:00
main-token-get-owner-set-client-error.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-token-get-owner-set-fail-response.test.js feat: permissions (#168) 2025-03-27 19:00:54 +00:00
main-token-get-owner-set-repo-fail-response.test.js feat: permissions (#168) 2025-03-27 19:00:54 +00:00
main-token-get-owner-set-repo-full-name.test.js feat: support full repository names in repositories input (#372) 2026-05-11 12:10:57 -07:00
main-token-get-owner-set-repo-invalid-format.test.js feat: support full repository names in repositories input (#372) 2026-05-11 12:10:57 -07:00
main-token-get-owner-set-repo-network-error.test.js feat: add support for enterprise-level GitHub Apps (#263) 2026-05-08 11:56:11 -07:00
main-token-get-owner-set-repo-non-current-full-name.test.js feat: support full repository names in repositories input (#372) 2026-05-11 12:10:57 -07:00
main-token-get-owner-set-repo-owner-mismatch.test.js feat: support full repository names in repositories input (#372) 2026-05-11 12:10:57 -07:00
main-token-get-owner-set-repo-set-to-many-newline.test.js feat: allow repositories input to be comma or newline-separated (#169) 2024-09-11 13:54:50 -07:00
main-token-get-owner-set-repo-set-to-many.test.js feat: allow repositories input to be comma or newline-separated (#169) 2024-09-11 13:54:50 -07:00
main-token-get-owner-set-repo-set-to-one.test.js test: fix test file extensions and inputs for repositories (#161) 2024-09-03 20:04:47 -07:00
main-token-get-owner-set-repo-unset.test.js feat: permissions (#168) 2025-03-27 19:00:54 +00:00
main-token-get-owner-unset-repo-full-name-and-bare.test.js feat: support full repository names in repositories input (#372) 2026-05-11 12:10:57 -07:00
main-token-get-owner-unset-repo-owner-mismatch.test.js feat: support full repository names in repositories input (#372) 2026-05-11 12:10:57 -07:00
main-token-get-owner-unset-repo-set.test.js test: fix test file extensions and inputs for repositories (#161) 2024-09-03 20:04:47 -07:00
main-token-get-owner-unset-repo-unset.test.js feat: permissions (#168) 2025-03-27 19:00:54 +00:00
main-token-permissions-set.test.js fix: permission input handling (#243) 2025-05-02 11:44:01 -07:00
main.js feat: support full repository names in repositories input (#372) 2026-05-11 12:10:57 -07:00
mock-agent.js build(deps-dev): bump undici from 7.24.6 to 8.2.0 (#366) 2026-05-08 14:40:33 -07:00
post-proxy-requires-native-support.test.js fix!: require NODE_USE_ENV_PROXY for proxy support (#342) 2026-03-13 17:21:42 -07:00
post-revoke-token-fail-response.test.js build(deps-dev): bump undici from 7.24.6 to 8.2.0 (#366) 2026-05-08 14:40:33 -07:00
post-token-expired.test.js build(deps-dev): bump undici from 7.24.6 to 8.2.0 (#366) 2026-05-08 14:40:33 -07:00
post-token-set.test.js build(deps-dev): bump undici from 7.24.6 to 8.2.0 (#366) 2026-05-08 14:40:33 -07:00
post-token-skipped.test.js build(deps-dev): bump undici from 7.24.6 to 8.2.0 (#366) 2026-05-08 14:40:33 -07:00
post-token-unset.test.js fix: use core.getBooleanInput() to retrieve boolean input values (#223) 2025-04-25 11:59:34 -07:00
README.md feat: add client-id input and deprecate app-id (#353) 2026-04-10 17:36:03 -07:00

Tests

Add one test file per scenario. You can run them in isolation with:

node tests/post-token-set.test.js

All tests are run together in tests/index.js, which can be executed with Node's built-in test runner

node --test tests/index.js

or with npm

npm test

How the tests work

The output from the tests is captured into a snapshot (tests/index.js.snapshot). It includes all requests sent by our scripts to verify it's working correctly and to prevent regressions.

To update snapshots after an intentional change:

node --test --test-update-snapshots tests/index.js

How to add a new test

We have tests both for the main.js and post.js scripts.