test: use node:crypto randomUUID instead of uuid dependency - #143
Conversation
The uuid package was a devDependency only used to generate temp file names in tests. Node's built-in crypto.randomUUID() covers this since Node 14.17 and the package requires Node >= 18. Removing the dependency also resolves the CVE-2026-41907 advisory flagged by Renovate in #139.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (19)
📝 WalkthroughWalkthroughChangesThe test suite replaces UUID dependency and gzip tests
TAR tests
TGZ tests
ZIP tests
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
package.jsonParsing error: Unexpected token : Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟢 Ready to approve
The change is limited to tests and devDependencies, and repository-wide searches show no remaining uuid references after the switch to crypto.randomUUID().
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR removes the uuid devDependency by switching test-only temporary file/directory name generation to Node’s built-in crypto.randomUUID(), aligning with the project’s Node >= 18 engine requirement and addressing the Renovate advisory context.
Changes:
- Replaced
uuid.v4()usage in test suites withrandomUUID()fromnode:crypto. - Removed
uuidfromdevDependenciesinpackage.json.
File summaries
| File | Description |
|---|---|
| test/zip/uncompress_stream.test.js | Switch temp destination directory naming from uuid.v4() to randomUUID() for zip uncompress stream tests. |
| test/zip/stream.test.js | Switch temp destination zip filename generation from uuid.v4() to randomUUID(). |
| test/zip/index.test.js | Switch zip test temp dir/file naming from uuid.v4() to randomUUID() across multiple cases. |
| test/zip/file_stream.test.js | Switch temp destination zip filename generation from uuid.v4() to randomUUID(). |
| test/tgz/uncompress_stream.test.js | Switch temp destination directory naming from uuid.v4() to randomUUID() for tgz uncompress stream tests. |
| test/tgz/stream.test.js | Switch temp destination tgz filename generation from uuid.v4() to randomUUID(). |
| test/tgz/index.test.js | Switch tgz test temp dir/file naming from uuid.v4() to randomUUID() across multiple cases. |
| test/tgz/file_stream.test.js | Switch temp destination tgz filename generation from uuid.v4() to randomUUID(). |
| test/tar/uncompress_stream.test.js | Switch temp destination directory naming from uuid.v4() to randomUUID() for tar uncompress stream tests. |
| test/tar/symlink-resolution.test.js | Switch per-test temp directory naming from uuid.v4() to randomUUID(). |
| test/tar/stream.test.js | Switch temp destination tar filename generation from uuid.v4() to randomUUID(). |
| test/tar/security-GHSA-cc8f-xg8v-72m3.test.js | Switch per-test temp directory naming from uuid.v4() to randomUUID() in security regression test. |
| test/tar/security-GHSA-4c3q-x735-j3r5.test.js | Switch per-test temp directory naming from uuid.v4() to randomUUID() in security regression test. |
| test/tar/index.test.js | Switch tar test temp dir/file naming from uuid.v4() to randomUUID() across multiple cases. |
| test/tar/file_stream.test.js | Switch temp destination tar filename generation from uuid.v4() to randomUUID(). |
| test/gzip/uncompress_stream.test.js | Switch temp destination output filename generation from uuid.v4() to randomUUID() for gzip uncompress stream tests. |
| test/gzip/index.test.js | Switch gzip test temp output filename generation from uuid.v4() to randomUUID() across multiple cases. |
| test/gzip/file_stream.test.js | Switch temp gzip output filename generation from uuid.v4() to randomUUID() across multiple cases. |
| package.json | Remove uuid from devDependencies. |
Review details
- Files reviewed: 19/19 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #143 +/- ##
=======================================
Coverage 97.15% 97.15%
=======================================
Files 19 19
Lines 1197 1197
Branches 309 309
=======================================
Hits 1163 1163
Misses 34 34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
[skip ci] ## <small>2.1.2 (2026-08-05)</small> * test: use node:crypto randomUUID instead of uuid dependency (#143) ([c0d269f](c0d269f)), closes [#143](#143) [#139](#139) * ci: add Node.js 26 to the test matrix (#141) ([5c725e6](5c725e6)), closes [#141](#141) [#140](#140) * fix: resolve symlink chains fully when extracting (#140) ([72a3c84](72a3c84)), closes [#140](#140)
|
🎉 This PR is included in version 2.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The uuid package was a devDependency only used to generate temp file names in tests. Node's built-in crypto.randomUUID() covers this since Node 14.17 and the package requires Node >= 18, so this drops the dependency entirely.
This also resolves the CVE-2026-41907 advisory flagged by Renovate, making #139 obsolete.
Verified with npm run lint and npm run test:js (171 passing, 3 pending).
Summary by CodeRabbit
Chores
Tests