Repository navigation
test: run the plugin's test files one after another - #7
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the intermittent CI failure: the "declared range" job on
mainat7ba0dc5failed every test intests/plugin.test.tswithSyntaxError: Unexpected end of JSON input, thrown bycreatePluginRuntimeTestHost. With #3's output the log now names the tests and the stack.Cause
@emdash-cms/plugin-test0.2's Vite config callsbuildPlugin()for every test file. The build writes into this package'sdist/, and the config then readsdist/manifest.jsonback into the host'sEMDASH_PLUGIN_MANIFESTbinding. One local run started 22 builds, seven at the same moment. When one file readsmanifest.jsonwhile 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: falseinpackages/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.