Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Dec 23, 2025

Summary

Extracts the npm package integration test logic from inline CI steps into reusable bash scripts that work both in CI and locally on Mac.

The scripts build all packages, start a local HTTP server to serve them, rewrite test project dependencies to use the local registry, and run the integration tests.

New scripts:

  • packages/playground/test-built-npm-packages/run-tests.sh - Main entry point
  • packages/playground/test-built-npm-packages/use-local-packages.sh - Rewrites package.json dependencies
  • Individual run-with-local-packages.sh scripts in each test project

Local usage:

# Run all tests (builds packages, starts server, runs tests)
./packages/playground/test-built-npm-packages/run-tests.sh

# Skip build if packages are already built
./packages/playground/test-built-npm-packages/run-tests.sh --skip-build

# Run only one test suite
./packages/playground/test-built-npm-packages/run-tests.sh --es-modules-only

Also fixes a bug where VERSION was set twice with different timestamps.

Test plan

  • CI passes on the test-built-npm-packages job
  • Scripts can be run locally on Mac

@adamziel adamziel marked this pull request as draft December 23, 2025 16:41
@adamziel
Copy link
Collaborator Author

adamziel commented Dec 23, 2025

Hm, I expected this to fail, something's off

@adamziel adamziel force-pushed the ci-generic-local-registry branch from 72979f2 to 5446f68 Compare December 23, 2025 18:10
The npm integration tests used to only install @wp-playground/cli from the local
package server, with the URL hardcoded in the workflow. This change makes the
local registry work for all @wp-playground/* and @php-wasm/* packages.

Now any playground package added to test project dependencies will automatically
be fetched from the local registry. The jq script rewrites package URLs at
runtime based on the package name pattern.

Also fixes a bug where VERSION was set twice with different timestamps - once
for the URL and once for updating package.json files.
@adamziel adamziel force-pushed the ci-generic-local-registry branch from 5446f68 to 25a46fc Compare December 23, 2025 18:12
@adamziel adamziel changed the title [CI] Use all built packages from local registry in npm integration tests [CI] Extract npm package integration tests to reusable scripts Dec 23, 2025
@adamziel
Copy link
Collaborator Author

Aha, I thought the built CJS packages are broken based on #3072 but they're not, at least I couldn't find any way to reproduce that error.

@adamziel adamziel marked this pull request as ready for review December 23, 2025 20:58
@adamziel adamziel merged commit 9a1e43a into trunk Dec 23, 2025
33 checks passed
@adamziel adamziel deleted the ci-generic-local-registry branch December 23, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants