Skip to content

package-layout: test:dist runs only the CJS entry test, name it test:cjs #442

Closed

Description

@Shinrai

docs/conventions/package-layout.md names the script that runs tests/cjs/entry.test.cjs after a build test:dist. That test only checks the CommonJS entry on the build (dist/index.cjs re-exports dist/index.mjs, the require(esm) guard, plus a bin smoke test in some repos). It doesn't run anything else against dist/, so test:cjs is the accurate name. Most of the fleet already calls it that.

test:dist should mean the whole suite run against the build without the <pkg>-dev condition. Nothing does that today, because tests import ../src/… by relative path, so dropping the condition changes nothing.

Repos that named the CJS check test:dist, to rename back to test:cjs: sizeofvar, envm, llm-translator, jsonv-prettier-plugin-jsonv, jsonv-eslint-plugin-jsonv, slothlet-vine.

Repos already on test:cjs: node-android-tv-remote, holdmytask, uuid, mxnet-control, wisp, stubborn-tcp, vitest-runner, jsonv, fix-headers, droidsock, gitmulti.

To do here:

  • package-layout.md: test:cjs for the entry check (script example, the slothlet section, the Tests section).
  • Decide how a real test:dist runs the suite against dist/ (tests import the package by name instead of ../src, so the condition picks src/ or dist/), then document it.

Activity

  1. added
    type: documentation
    priority: medium
    area: tests
    status: in progress
    on Nov 8, 2026
  2. Shinrai commented on Nov 8, 2026

    @Shinrai
    ContributorAuthor

    To pin down the two names for package-layout.md:

    • test:cjs runs the tests that check CommonJS only, in repos that have any.
    • test:dist runs the repo's full test suite against dist/ instead of src/.

    Both should be documented as standard scripts. llm-translator is getting a real test:dist now. Its build mirrors src/ file by file (tsup bundle: false), so the vitest config redirects src/ imports to dist/ in a dist mode rather than changing every test's imports. That's one way to do it for unbundled builds. Bundled builds would still need tests to import by package name.

  3. Shinrai commented on Nov 8, 2026

    @Shinrai
    ContributorAuthor

    One addition: test:cjs also covers the CJS entry point (dist/index.cjs loading dist/index.mjs), not just CJS-specific tests.

  4. added
    status: implemented
    and removed
    status: in progress
    on Nov 8, 2026
  5. Shinrai commented on Nov 8, 2026

    @Shinrai
    ContributorAuthor

    Landed on next in #443 (d9ded9a). test:cjs is the CommonJS entry check plus any CommonJS-only tests; test:dist is the full suite against dist/, by package name or, for unbundled builds, by redirecting src/ to dist/. Set status: implemented by hand, the PR body lost its closing keyword when the branch was refreshed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: testspriority: mediumstatus: implementedtype: documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions