Repository navigation
Declare missing module dependencies - #1485
Conversation
k3s imports tar-stream and selenium imports tar-fs and tmp at runtime without declaring them, so they only resolve through npm hoisting and crash on import under strict installs (pnpm hoist=false, Yarn PnP). Declare them, plus azurite's test-only @azure/core-auth, and enable Biome's noUndeclaredDependencies rule to keep it that way.
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The dependency declarations and lockfile are consistent, and the new lint rule helps catch undeclared dependencies. No material merge risk remains. Pre-merge checks |
|
Summary
@testcontainers/k3sand@testcontainers/seleniumimport packages at runtime that they don't declare. They only resolve today because npm hoists them fromtestcontainers's own dependency tree. Under a strict layout (pnpm withhoist=false, Yarn PnP) both modules crash on import.@testcontainers/k3star-stream(k3s-container.ts:2)dependencies(+@types/tar-streamdev)@testcontainers/seleniumtar-fs,tmp(selenium-container.ts)dependencies(+@types/tar-fs,@types/tmpdev)@testcontainers/azurite(test utils only)@azure/core-authdevDependenciesVersion ranges match what is already resolved in the lockfile, so
package-lock.jsononly gains the new manifest entries and no installed version changes.To stop this from coming back, this enables Biome's
noUndeclaredDependenciesrule. Biome is already our linter, so no new tooling is needed. It's turned off for*.test.tsbecausevitestis declared at the workspace root, which the rule doesn't look at.Reproduction (published 12.2.0)
With tarballs packed from this branch, the same strict install imports both modules successfully.
Verification
npx biome lint .givesFound 4 errors.(k3s-container.ts:2,selenium-container.ts:3,selenium-container.ts:16,azurite-test-utils.ts:1)npx biome lint .givesChecked 456 files ... No fixes applied.@testcontainers/k3sand@testcontainers/seleniumtarballs:require()works for both (it fails on 12.2.0, see above).npm run check-compiles: passesnpm run format/npm run lint: no changesNo runtime code changed, so the module test suites weren't rerun.
Not breaking
This only adds dependencies that were already installed transitively at the same versions. No source or public API changes. npm users see no difference; strict package-manager users go from a crash on import to working.
Follow-up (not in this PR)
@testcontainers/gcloudexportsSpannerEmulatorHelper, which imports@google-cloud/spanner(types plus a dynamic import), but spanner is only adevDependency. The docs ask users to install it themselves, so it is intentionally user-provided. It is probably best declared as an optionalpeerDependency, but that can make npm report conflicts for users on other spanner majors, so it deserves its own discussion.