Skip to content

ci: smoke test the build output on Node.js 18 - #174

Open
shaurya703 wants to merge 1 commit into
tinylibs:mainfrom
shaurya703:ci/smoke-test-node-18
Open

ci: smoke test the build output on Node.js 18#174
shaurya703 wants to merge 1 commit into
tinylibs:mainfrom
shaurya703:ci/smoke-test-node-18

Conversation

@shaurya703

Copy link
Copy Markdown

Closes #57

engines.node is ">=18" but the CI matrix starts at 20, so the oldest supported version was never exercised. #109 tried adding 18 to the existing matrix and stalled: tsdown, vitest and even node:test are unusable on 18.x, and downgrading the dev stack to reach it was not worth it.

This takes the approach settled on in that thread instead:

  • a new test case (or describe block) which tests dist/
  • a standalone test file excluded from vitest which uses node:assert but no test runner

test/smoke.mjs checks the happy path of the built bundle:

  • x() — stdout, stderr, argument forwarding, async iteration, exit codes, throwOnError, and env
  • xSync() — stdout, exit code, throwOnError
  • exec/execSync alias identity

Why this one works where #109 didn't

The job deliberately skips npm ci. The smoke test imports dist/ and node builtins and nothing else, so the dev dependencies that made 18.x unworkable are never installed. It runs on 18.0.0 and 18.x across ubuntu and windows, against the same dist/ artifact the other jobs already consume.

process.execPath is used for every child command, so the same file runs unmodified on Windows.

vitest only collects src/**/*_test.ts, so the file is excluded from the unit run without any extra configuration.

Verification

Run against a real v18.0.0 (not just 18.x): 10/10 pass.

The suite isn't vacuous — stubbing the exitCode getter in dist/ turns 3 of the 10 red and exits 1.

On the current toolchain, vitest still reports 51 passed, and lint, publint and format:check stay clean.

Closes tinylibs#57

engines.node is ">=18" but the CI matrix starts at 20, so the oldest
supported version was never exercised. tinylibs#109 tried adding 18 to the
existing matrix and stalled: tsdown, vitest and even node:test are
unusable on 18.x, and downgrading the dev stack to reach it was not
worth it.

This takes the approach settled on in that thread instead — a standalone
file using node:assert with no test runner, checking the happy path of
the built bundle:

  - x(): stdout, stderr, argument forwarding, async iteration, exit
    codes, throwOnError, and env
  - xSync(): stdout, exit code, throwOnError
  - exec/execSync alias identity

The job deliberately skips `npm ci`. The smoke test imports dist/ and
node builtins and nothing else, so the dev dependencies that made 18.x
unworkable are never installed. It runs on 18.0.0 and 18.x across ubuntu
and windows, against the same dist/ artifact the other jobs consume.

vitest only collects src/**/*_test.ts, so the file is excluded from the
unit run without further configuration.

Verified against a real v18.0.0: 10/10 pass. The suite is not vacuous —
stubbing the exitCode getter in dist/ turns 3 of the 10 red and exits 1.
On the current toolchain, vitest still reports 51 passed and lint,
publint and format:check stay clean.
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.

Update CI to test against 18.0.0

2 participants