Files
ArtPlayer/test/package/README.md
T

4.1 KiB

Installed package checks

Run yarn test:package with the pinned Node and Yarn after a frozen install. The initial scope is core and chapter; extend names in scripts/package-consumer.mjs and add package-specific consumers when migrating another package.

scripts/package-check.mjs copies source into an ignored build snapshot, rebuilds all three formats and core languages using repository scripts, and runs Yarn pack. It checks manifest targets, historical distribution files, archive members and unexpected source/configuration files. It then installs the tarballs in a fresh OS temporary directory outside the repository, using the root lock to resolve runtime dependencies offline, and repeats installation with a frozen consumer lock. Install hooks are disabled; packages with such hooks are rejected until covered.

Only the build snapshot links workspace build tools. The consumer has no workspace package links, NODE_PATH is cleared, installed files must match archive hashes, and compiler inputs may only resolve inside that consumer or the pinned compiler's standard library. Temporary consumers are cleaned up after success or failure.

runtime.cjs tests CJS, ESM, UMD, AMD, legacy and language entrypoints, SSR import, export restrictions and shared Emitter behavior. Public property descriptors and default configuration are compared against the fixed published core/chapter. This is a targeted compatibility check, not a complete behavioral API comparison.

Custom-UA SSR profiles run actual UMD/legacy bytes and direct ESM imports with no window/document/navigator shim. The frozen baseline's iOS/Macintosh ReferenceErrors are asserted only in explicit baseline mode; candidates must import successfully. The checks retain callback-free server imports, no UMD timers, and the browser-only constructor error. A negative fixture verifies the old package fails candidate mode.

Public, chapter-options, chapter-exports, language and legacy-plugin consumers run with TS 5.9.3 (Node10, NodeNext CJS/ESM and Bundler) and TS 4.3.5 (Node10). NodeNext CJS also checks import-equals/require and namespaced types. PKG-CHAPTER-04 resolved the initial type failures; all five groups now require zero diagnostics. Exact known diagnostics are referenced by known-types.json and test/types/known-diagnostics.json. Unexpected errors and unexpectedly removed errors both require investigation. Remove a known case when its owning task fixes it; keep frozen release evidence intact. yarn test:package:release additionally rejects any remaining known type errors. Passing this command alone is not authorization or sufficient evidence to publish.

The optional core artplayer/runtime entry has eight additional strict consumer groups: TS 5.1.6 and 5.9.3 each check Node10 CommonJS, NodeNext CJS/ESM and Bundler. These fixtures cover accurate returns and getter/setter types, construction-stage callback hosts, both old and new module augmentations, old chapter factories and the shared modern/legacy constructor. The old root remains isolated from modern accessor syntax and retains its five original consumer groups. Runtime checks verify the added entries reuse existing JS module and constructor identities; runtime/types remains type-only. All generated core declarations are packaged, while their authored public/ source graph and internal implementation are excluded.

Reports, archives, installed artifact copies and build/install logs are under refactor/.cache/packages/run-*; latest.json points to the last successful compatibility run (a strict release rejection still leaves its report). For browser validation set ARTPLAYER_BROWSER_ARTIFACTS to that run's browser-artifacts.json and run yarn test:browser. The service then uses installed package bytes without falling back to source. CI performs this sequence and uploads only reports and artifacts, excluding the build snapshot's node_modules link.

test/package-check.test.js verifies missing targets, leaked configuration and removed historical files, then deliberately removes an actual published default export and required entry in an isolated consumer to prove runtime failures are detected. It is part of yarn test:node.