Skip to content

perf: optimize test fixture setup with FixtureTemplate#1299

Closed
sorccu wants to merge 15 commits into
next/v8from
simo/sim-245-optimize-test-fixture-setup
Closed

perf: optimize test fixture setup with FixtureTemplate#1299
sorccu wants to merge 15 commits into
next/v8from
simo/sim-245-optimize-test-fixture-setup

Conversation

@sorccu
Copy link
Copy Markdown
Member

@sorccu sorccu commented May 13, 2026

Summary

Introduce FixtureTemplate to pre-install dependencies once and share them across fixtures via symlinks, reducing pnpm install calls from 53 to 1.

  • Add FixtureTemplate class that caches pre-installed node_modules
  • Add vitest globalSetup to build the playwright template once
  • Migrate playwright-check and parse-files tests to use template
  • Set installPackages: false for fixtures with no deps
  • Symlink workspace checkly package into all fixture node_modules
  • Remove injectPackedSelf (dead code) and pnpm pack from test scripts
  • Remove accidentally committed node_modules from test-bundling fixtures

Depends on: #1298

Test plan

  • All 64 test files pass (900 tests)
  • Test duration significantly reduced (~29s vs previous)

🤖 Generated with Claude Code

sorccu and others added 15 commits May 9, 2026 03:18
BREAKING CHANGE: Drop support for Node.js 18. The new engine range
is ^20.19.0 || >=22.12.0, which ensures require(esm) support for
CJS consumers of the library.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prerequisite for ESM migration. Node.js ESM requires explicit file
extensions on relative imports.

Test fixtures with their own package.json are excluded since they
represent user projects with independent module resolution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BREAKING CHANGE: Both packages now emit ESM instead of CJS.
CJS consumers on Node 20.19+ can still require() the library
thanks to Node's native require(esm) support.

- Set "type": "module" in both packages
- Switch tsconfig module from node16/commonjs to nodenext
- Remove esModuleInterop and ignoreDeprecations (unnecessary with ESM)
- Update bin scripts to use oclif's ESM execute() entry point
- Fix remaining import paths (from '..' → '../index.js', module augmentation)
- Upgrade conf 10→15 and p-queue 6→9 (ESM-only, now compatible)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace Node.js CJS globals with import.meta.url-based alternatives
since the packages now emit ESM.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ESM modules don't have require() in scope. Use createRequire from
node:module for the remaining cases that need synchronous CJS loading:
ts-node file loader, typescript-estree parser, and playwright version
detection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now that both packages emit ESM, update all dependencies that were
blocked on ESM-only versions:

- chalk 4.1.2 → 5.6.2
- conf 10.2.0 → 15.1.0 (done in ESM switch commit)
- indent-string 4.0.0 → 5.0.0
- log-symbols 4.1.0 → 7.0.1
- open 8.4.2 → 11.0.0
- p-queue 6.6.2 → 9.2.0 (done in ESM switch commit)
- nanoid 3.3.12 → 5.1.11
- uuid 11.1.1 → 14.0.0
- execa 5.1.1 → 9.6.1 (create-cli)
- ora 5.4.1 → 9.4.0 (create-cli)
- passwd-user 3.0.0 → 4.0.0 (create-cli)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adapt to export changes in the updated ESM versions:
- log-symbols v7: namespace import → default import
- execa v9: default import → named import
- passwd-user v4: default import → named import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- config 3.3.12 → 4.4.1
- dotenv 16.6.1 → 17.4.2
- glob 10.5.0 → 13.0.6
- lint-staged 15.5.2 → 16.4.0
- minimatch 9.0.9 → 10.2.5
- rimraf 5.0.10 → 6.1.3

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now that the package is ESM, dynamic import() for execa is no longer
needed. Use regular static imports instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BREAKING CHANGE: ts-node is no longer supported as a TypeScript file
loader. jiti is now a direct dependency and the only TypeScript loader.

- Remove ts-node loader from both packages
- Move jiti from optional peer dependency to regular dependency
- Enable tsconfigPaths in jiti for automatic path alias resolution
- Remove jiti from all fixture, example, and e2e project package.json
  files (no longer needed as a user devDependency)
- Stop injecting jiti into user's package.json during import and init
- Regenerate affected lockfiles

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use createRequire(path.join(cwd, 'noop.js')) instead of
createRequire(import.meta.url) so module resolution is relative
to the user's project directory, not the CLI's install location.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BREAKING CHANGE: The project now uses pnpm as its package manager.

- Replace package-lock.json with pnpm-lock.yaml (imported via pnpm import)
- Add pnpm-workspace.yaml for workspace configuration
- Update all CI workflows to use pnpm
- Update all npm scripts to use pnpm equivalents
- Update simple-git-hooks to use pnpm exec
- Add pnpm.onlyBuiltDependencies for esbuild and simple-git-hooks
- Replace fixture npm lockfiles with pnpm lockfiles
- Update test expectations for pnpm-lock.yaml in bundled file lists

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce FixtureTemplate to pre-install dependencies once and share
them across fixtures via symlinks, reducing pnpm install calls from
53 to 1.

- Add FixtureTemplate class that caches pre-installed node_modules
- Add vitest globalSetup to build the playwright template once
- Migrate playwright-check, parse-files tests to use template
- Set installPackages: false for fixtures with no deps (agentic-check,
  api-check, browser-check, project-parser)
- Symlink workspace checkly package into all fixture node_modules
- Remove injectPackedSelf (dead code) and pnpm pack from test scripts
- Remove accidentally committed node_modules from test-bundling and
  test-shared-bundling fixtures

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

⚠️ AI context is out of date

The skills/ directory doesn't match the generated output from packages/cli.

Please run the following locally and commit the changes:

pnpm run prepare

@sorccu
Copy link
Copy Markdown
Member Author

sorccu commented May 14, 2026

Superseded by #1298 which now includes the FixtureTemplate optimization.

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