fix: improve test coverage and add dist build#560
Closed
GarthDB wants to merge 3 commits intochangesets:mainfrom
Closed
fix: improve test coverage and add dist build#560GarthDB wants to merge 3 commits intochangesets:mainfrom
GarthDB wants to merge 3 commits intochangesets:mainfrom
Conversation
Add support for npm OIDC trusted publishing, eliminating the need for long-lived NPM tokens. This implementation: - Adds 'oidcAuth' input parameter to enable OIDC mode - Validates npm version >= 11.5.1, id-token permission, and no NPM_TOKEN conflict - Skips .npmrc creation when OIDC is enabled to allow npm auto-detection - Maintains full backward compatibility with existing NPM_TOKEN workflows - Provides clear, actionable error messages for validation failures Features: - Strict validation with helpful error messages - Comprehensive test coverage (26 tests passing) - Full documentation with migration guide - Zero .npmrc creation in OIDC mode for seamless npm integration Closes #1
Address critical and medium priority recommendations: P0 - Fix Integration Tests: - Add file operation verification tests - Verify validateOidcEnvironment is called in OIDC mode - Verify validateOidcEnvironment is NOT called in legacy mode - Add proper test for OIDC validation failure handling - Improve test assertions for fs.writeFile/appendFile calls P1 - Move Authentication Validation Earlier: - Validate authentication before readChangesetState() is called - Provides immediate feedback for misconfigured authentication - Improves user experience by failing fast - Separate validation from .npmrc creation logic P2 - Add Provenance Attestation Documentation: - Document cryptographic provenance attestation - Explain verified badge on npmjs.com - Link to npm trusted publishers documentation Results: - 27 tests passing (added 1 new test) - Type checking passes - Build succeeds - All critical and medium priority recommendations addressed
|
- Extract setupNpmAuth and createNpmrcFile functions for better testability - Rewrite integration tests to actually execute code paths - Verify fs.writeFile is NOT called in OIDC mode - Verify fs.writeFile IS called in legacy mode - All 13 tests passing with proper code execution Fixes test coverage issues identified in PR review. Note: dist/ folder will be committed only to release tags, following the same pattern as the official changesets/action repository.
79fa10b to
24b7c71
Compare
Author
|
Sorry, I created this pr incorrrectly. I meant to create it against my own fork to test it further. |
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.
Summary
This PR addresses two critical issues:
Changes
Test Improvements
setupNpmAuthandcreateNpmrcFilefunctions for better testabilityfs.writeFileis NOT called in OIDC modefs.writeFileIS called in legacy modeDist Folder Fix
dist/from.gitignoreto allow committing built filesdist/index.jsto repositorydist/index.jsnot foundTesting
Related Issues