docs: document that unit tests require TEST_SNYK_TOKEN - #7062
Draft
rrama wants to merge 1 commit into
Draft
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
|
cursor
Bot
force-pushed
the
docs/unit-test-token-requirement
branch
from
July 31, 2026 17:08
5c5ee98 to
458b5a2
Compare
Co-authored-by: Ben Durrans <Benjamin.Durrans@snyk.io>
rrama
force-pushed
the
docs/unit-test-token-requirement
branch
from
July 31, 2026 17:11
458b5a2 to
e14c521
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Submission Checklist
What does this PR do?
Documents that
npm run test:unitrequiresTEST_SNYK_TOKEN.Without it, four suites fail with
MissingApiTokenError, because they drive command entry points that callvalidateCredentialsbefore doing anything else:test/jest/unit/lib/commands/fix/fix.spec.tstest/jest/unit/python/snyk-test-pyproject.spec.tstest/jest/unit/pnpm/snyk-test-pnpm-project.spec.tstest/jest/unit/snyk-code/snyk-code-test-report.spec.tsThis wasn't written down anywhere.
CONTRIBUTING.mdmentionsTEST_SNYK_TOKENonly under acceptance tests, andAGENTS.mdshowed a barenpm run test:unit.The part worth documenting explicitly is that reaching for
SNYK_TOKEN— the obvious variable, and the one the CLI itself uses — has no effect.test/setup.jsdeletesSNYK_TOKENandSNYK_API_KEY, then writesTEST_SNYK_TOKENinto the CLI user config. That's sensible (tests run against a known configuration rather than whatever the developer is authenticated as), but from the outside it looks like the token is being ignored and the tests are simply broken.This came out of an agent reporting these suites as failures during environment setup, having concluded from the error that
SNYK_TOKENwas needed. It isn't, and setting it changes nothing.No behaviour is changed here — this only documents what already happens. Whether these suites should need a token is a separate question:
CONTRIBUTING.mdstates unit tests "should not test services outside the code itself", so arguably they belong at the acceptance layer. Happy to raise that separately if the team agrees.Where should the reviewer start?
CONTRIBUTING.md-> "Unit tests". TheAGENTS.mdchange mirrors it.How should this be manually tested?
What's the product update that needs to be communicated to CLI users?
None — contributor documentation only.
Risk assessment: Low
Documentation only.
Made with Cursor