Skip to content

Replace the 105-link npm test chain with a discovering, parallel test runner - #20

Closed
domidex01 wants to merge 2 commits into
flowtricks:mainfrom
domidex01:issue/test-runner
Closed

domidex01 wants to merge 2 commits into
flowtricks:mainfrom
domidex01:issue/test-runner

Conversation

@domidex01

Copy link
Copy Markdown

The problem

npm test was a single && chain of 105 npm run links — a six-thousand-character line. It spawned a fresh npm per file, ran strictly serially, and short-circuited at the first failure: on Windows it dies at link 15 (test:popoverdropdown) and the other ninety tests never run at all. Adding a test file meant hand-editing that line in addition to adding the per-file script — and at least one test (test/doc-defaults.js) existed but had never been added to the chain, so the gate silently never ran it.

The change

A small scripts/test.js that:

  • discovers test/*.js, so a new test file is in the gate the moment it exists — doc-defaults.js is now running (and passing);
  • runs files in parallel with a concurrency cap (--jobs=N, default min(8, cores)) — safe because every test uses listen(0) and mkdtemp, verified by comparing parallel results against isolated serial runs;
  • prints every failure rather than the first, with each failing file's full output, and exits non-zero if any failed;
  • routes *.test.js through node --test, thumbs.js through electron, and everything else through plain node (with --disable-warning=MODULE_TYPELESS_PACKAGE_JSON, which two scripts already used);
  • takes filename substrings as arguments to run a subset (node scripts/test.js focus color).

The 105 per-file test:* scripts stay for running one test at a time.

Numbers

Full suite on Windows: 45 seconds wall-clock, 110 files, 100 passed, 10 failed — where the old chain died at file 15 and reported one failure. The 10 failures are pre-existing: each fails identically when run alone, serially (code-search, field-focus, git-snapshot, git-branches, panel-field, popover-dropdown, preview-worktree, starter, section-dot, vars-row-height). The chain was hiding all but the first of them.

npm test was a && chain of 105 npm run links: a fresh npm per file,
strictly serial, dead at the first failure, and a hand-edit in two
places for every new test. On Windows it died at link 15 and the other
ninety never ran.

scripts/test.js discovers test/*.js, runs the files in parallel (they
all use listen(0) and mkdtemp, so they don't collide), prints every
failure rather than the first, and exits non-zero if any failed.
*.test.js files go through node --test, thumbs.js through electron,
everything else through plain node. Arguments filter by filename
substring; --jobs=N caps the workers.

Discovery also picks up doc-defaults.js, a test that existed but had
never been added to the chain. The per-file npm scripts remain for
running one test at a time.
@cusable cusable closed this Sep 28, 2026
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.

2 participants