perf: optimize test fixture setup with FixtureTemplate#1299
Closed
sorccu wants to merge 15 commits into
Closed
Conversation
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>
|
Member
Author
|
Superseded by #1298 which now includes the FixtureTemplate optimization. |
5 tasks
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.
Summary
Introduce
FixtureTemplateto pre-install dependencies once and share them across fixtures via symlinks, reducingpnpm installcalls from 53 to 1.FixtureTemplateclass that caches pre-installednode_modulesglobalSetupto build the playwright template onceinstallPackages: falsefor fixtures with no depsnode_modulesinjectPackedSelf(dead code) andpnpm packfrom test scriptsnode_modulesfrom test-bundling fixturesDepends on: #1298
Test plan
🤖 Generated with Claude Code