Skip to content

test: run the plugin's test files one after another - #7

Merged
danielmlr merged 1 commit into
mainfrom
fix/serial-test-files
Sep 25, 2026
Merged

danielmlr merged 1 commit into
mainfrom
fix/serial-test-files

Conversation

@danielmlr

Copy link
Copy Markdown
Member

Fixes the intermittent CI failure: the "declared range" job on main at 7ba0dc5 failed every test in tests/plugin.test.ts with SyntaxError: Unexpected end of JSON input, thrown by createPluginRuntimeTestHost. With #3's output the log now names the tests and the stack.

Cause

@emdash-cms/plugin-test 0.2's Vite config calls buildPlugin() for every test file. The build writes into this package's dist/, and the config then reads dist/manifest.json back into the host's EMDASH_PLUGIN_MANIFEST binding. One local run started 22 builds, seven at the same moment. When one file reads manifest.json while another file's build is rewriting it, the binding is an empty string, JSON.parse("") throws, and every test in that file fails at setup (0–11 ms each in the log). The parallel builds also load the runner, which fits the earlier timeouts.

Change

fileParallelism: false in packages/analytics/vitest.config.ts: test files run one after another, so builds never overlap. Locally 88 s instead of 38 s; 288 tests pass.

The cause is upstream and unchanged on upstream/main (packages/plugin-test/src/config.ts). The real fix belongs there: build once per run, or into a per-call directory.

No changeset: test configuration only.

The CI run on main at 7ba0dc5 failed every test in plugin.test.ts with
"Unexpected end of JSON input" from createPluginRuntimeTestHost. The
test host's config builds the plugin into this package's dist/ once per
test file and reads dist/manifest.json back; one local run started 22
builds, seven of them at the same moment. A file whose read lands in
the middle of another file's write gets an empty manifest and fails as a
whole. The parallel builds also load the runner, which is where the
earlier timeouts came from.

Files now run sequentially: 88 s instead of 38 s locally, and no
concurrent builds. The cause is in @emdash-cms/plugin-test and unchanged
on upstream/main.
@danielmlr
danielmlr merged commit f8fe094 into main Sep 25, 2026
2 checks passed
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.

1 participant