Skip to content

Speed up monaco-graphql bundle assertion test#4298

Open
trevor-scheer wants to merge 6 commits into
graphiql-6from
trevor/monaco-graphql-test-perf
Open

Speed up monaco-graphql bundle assertion test#4298
trevor-scheer wants to merge 6 commits into
graphiql-6from
trevor/monaco-graphql-test-perf

Conversation

@trevor-scheer
Copy link
Copy Markdown
Contributor

@trevor-scheer trevor-scheer commented May 18, 2026

Summary

  • Replaces the examples/monaco-graphql-react-vite build target with a minimal fixture under packages/monaco-graphql/__fixtures__/bundle-test/ that imports only monaco-graphql's public API and wires graphql + json workers. No React, no example-app baggage, no TypeScript language support.
  • Replaces the previous execa-driven yarn workspace ... build shell-out with Vite's programmatic build() API. Drops write: false, minify: false, target: 'esnext', reportCompressedSize: false, and treeshake: false since the assertion only cares about the chunk file list, not the bundle contents or size.
  • Adds an explicit negative regex assertion against /typescript|tsMode|tsWorker|ts\.worker|cssMode|css\.worker|htmlMode|html\.worker/i, so the test's intent ("don't bundle unwanted Monaco language modules") is readable from the assertion, not just the snapshot.
  • Removes the now-unused execa devDependency.
  • Local test runtime drops from ~8.5s to ~2.3s. CI runtime is ~32s, dominated by Rollup traversing monaco-editor's module graph; the new minimal-fixture surface and dropped transforms don't change that floor. Vitest timeout set to 60s (~28s headroom).

Test plan

  • Run yarn workspace monaco-graphql test and confirm both tests pass in under 5s locally.
  • Confirm the snapshot lists only editor core, graphql, and json chunks (no TypeScript, CSS, or HTML language service modules).
  • Sanity-check the negative assertion by manually adding a TypeScript worker import to the fixture, rerunning the test, and confirming it fails with the explicit message before reverting.

Notes

CI runtime stays close to the previous version because monaco-editor's bundle graph itself is the cost. Getting CI under ~5s would require switching to static module-graph inspection (resolving but not bundling monaco-editor) or to a faster bundler with a worker plugin. Filed as a follow-up rather than blocking this change.

Replace the `execa`-based `yarn workspace example-monaco-graphql-react-vite build`
shell command with Vite's programmatic API, passing `write: false`, `treeshake: false`,
`target: 'esnext'`, and `reportCompressedSize: false`.

These options together cut local test runtime from ~8.5s to ~4.3s (2x), and should
reduce CI runtime from ~50s to ~25s, keeping it comfortably under the 30s timeout.

The assertion changes from parsing Vite's stdout (including `dist/` prefixes and
ANSI stripping) to reading `result.output.map(f => f.fileName)` directly, which
is more robust and does not depend on Vite's CLI output format. The set of
asserted files is identical.

Removes `execa` from devDependencies since it is no longer used.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

⚠️ No Changeset found

Latest commit: ef50db6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

- `import path from 'node:path'` to satisfy oxlint unicorn rule
- add `treeshake` to cspell custom words
- run oxfmt to fix formatting
- raise test timeout to 90s; CI hardware is slower than local
Replaces the full `examples/monaco-graphql-react-vite` build target with
a tiny fixture under `packages/monaco-graphql/__fixtures__/bundle-test/`
that imports only `monaco-graphql`'s public API and wires graphql + json
workers. No React, no TypeScript language support.

Reduces local test time from ~4s to ~2.3s (wall); CI should drop well
under 10s. Timeout lowered from 90s to 30s.
@trevor-scheer trevor-scheer marked this pull request as ready for review May 18, 2026 02:39
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