Skip to content

test(build): add post-build tests for ESM/UMD bundles and API surface gate#8845

Open
kpal81xd wants to merge 1 commit into
mainfrom
feature-post-build-tests
Open

test(build): add post-build tests for ESM/UMD bundles and API surface gate#8845
kpal81xd wants to merge 1 commit into
mainfrom
feature-post-build-tests

Conversation

@kpal81xd
Copy link
Copy Markdown
Contributor

@kpal81xd kpal81xd commented Jun 4, 2026

Summary

Build-output regressions ship undetected today — the unit suite runs against src/, and CI only
publints the bundles. That's how #8836 (pc.app null in UMD) and #8839 (getter-only exports
breaking pc.createScript overrides) reached users. Closes #8838.

Adds two post-build guards:

Guard Command Checks CI job
Post-build runtime suite (test/bundles/) npm run test:build each built bundle (rel/dbg/prf/min × UMD/ESM) loads (UMD global + CJS, ESM import) and boots an Application; runtime exports match src/index.js; pc.app live binding (#8836/#8837); UMD exports overridable (#8839); blanket invariant — every UMD export is a live + overridable accessor build
Public API surface gate (api-extractor) npm run api:check built .d.ts signatures vs committed etc/playcanvas.api.md; bless intentional changes with npm run api:update. Report holds only declarations, so it's stable against unrelated edits typescript-declarations

Example

image

Verification

Check Result
npm run test:build 60 passing
npm run api:check pass (verified stable against .d.ts line shifts)
npm test (unit) 1748 passing, unchanged
revert UMD footer to broken forms corresponding test:build specs fail (#8836 + #8839)

New dev dependency: @microsoft/api-extractor.

… gate

The mocha suite runs against src/ and CI only publints the bundles, so
build-output regressions ship undetected (e.g. #8836 pc.app null in UMD,
#8839 getter-only exports breaking pc.createScript overrides).

- test/bundles/: post-build mocha suite (npm run test:build) loading the built
  bundles (rel/dbg/prf/min x UMD/ESM) - each loads (UMD global + CJS, ESM
  import) and boots an Application; runtime exports match src/index.js; pc.app
  live binding (#8836/#8837); UMD exports overridable (#8839); plus a blanket
  invariant that every UMD export is a live + overridable accessor.
- api-extractor: public API surface gate. npm run api:check verifies the built
  .d.ts against etc/playcanvas.api.md (compact colored diff on failure);
  npm run api:update regenerates it. Scratch report under build/.api-extractor/.
  New dev dependency: @microsoft/api-extractor.
- CI: run test:build in the build job; api:check in the typescript-declarations job.

Closes #8838
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add post-build tests for the main build targets (ESM and UMD)

1 participant