Skip to content

Run the smoke tests against the packed package - #1499

Draft
cristianrgreco wants to merge 2 commits into
mainfrom
claude/smoke-test-packed-package
Draft

cristianrgreco wants to merge 2 commits into
mainfrom
claude/smoke-test-packed-package

Conversation

@cristianrgreco

@cristianrgreco cristianrgreco commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The smoke tests now run against the package as it is published, with only its production dependencies installed.

A new smoke-test-setup action does the setup for both smoke-test jobs:

  1. Builds and packs packages/testcontainers.
  2. Runs npm ci --omit=dev --workspace packages/testcontainers, which installs only the package's production dependencies, at the versions in package-lock.json.
  3. Moves that node_modules into an empty project in the runner's temp directory and replaces the workspace link with the unpacked tarball.
  4. Copies the smoke-test files there and returns the directory as its path output.

The jobs then run the smoke tests from that directory. Other changes:

  • smoke-test.js, smoke-test.mjs and smoke-test.jest.js import testcontainers by name instead of ./build/index. They still run from the repository after a build, because the workspace link resolves the name to build/index.js.
  • The npm prune --omit=dev step is removed.

Why

The prune step never produced a production-only environment. Measured locally, it removes 11 packages (the package's @types/* dev dependencies) and leaves about 325 installed, including vitest, TypeScript and Biome from the root. And because the tests imported ./build/index from inside the repository, they never went through the package's main entry or its files list.

Dependency versions are unchanged: they still come from package-lock.json, so a run is reproducible and can't fail because of a new upstream release.

Verification

The action's two scripts were run locally, verbatim, in a copy of the repository installed the way the job installs it:

  • The empty project has 172 packages. Every one is at its package-lock.json version and none is dev-only. vitest, TypeScript, Biome and shx are absent.
  • node_modules/testcontainers is a real directory holding the tarball's files (build, package.json, README.md, LICENSE), plus the two dependencies the lockfile nests under the package (undici, get-port).
  • With Docker, from that project: node ./smoke-test.js and node ./smoke-test.mjs exit 0, and the Jest smoke test passes (1 test).
  • Red checks, each against the same project:
    • "main" pointed at a missing file: fails with Please verify that the package.json has a valid "main" entry. The old test's import of ./build/index still loads in that state.
    • A production dependency (byline) removed: fails with Cannot find module 'byline'.
  • npm run format, npm run lint: no fixes applied.
  • Not run locally: the Bun steps, since Bun isn't installed here. CI covers them.

Related PRs

Why this isn't breaking

CI and smoke-test files only. The smoke-test files aren't published (files is ["build"]), and no package source or dependency changes.

Pack the built package and install the tarball into an empty project, then
run the smoke tests there. They now import "testcontainers" by name, so
they exercise the published files, the `main` entry and only the declared
production dependencies.
@cristianrgreco cristianrgreco added maintenance Improvements that do not change functionality patch Backward compatible bug fix labels Oct 11, 2026
Install the production dependencies with `npm ci --omit=dev` so the smoke
tests use the versions in package-lock.json, then swap the workspace link
for the unpacked tarball. Both jobs now share this through a
smoke-test-setup action.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Improvements that do not change functionality patch Backward compatible bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant