mirror of
https://github.com/actions/create-github-app-token.git
synced 2026-12-01 14:55:26 +00:00
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 <223556219+Copilot@users.noreply.github.com> Copilot-Session: b91f96b7-a7f3-4ff3-8f52-3a617307ede2
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.
- If you do not expect an error, take main-token-permissions-set.test.js as a starting point.
- If your test has an expected error, take main-missing-client-and-app-id.test.js as a starting point.