mattpocock / mattpocock/evalite

phantom dependency from evalite to vitest

Open
#398 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.7k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Hi @mattpocock huge fan of your work.

I'm using pnpm with a very strict config = no hoisting.

Unfortunately, this breaks evalite because it can't find vitest. It seems evalite is missing a dependency.

Claude seemt to agree with me:


  Now, to the task. You want to use pnpm's packageExtensions to declare a missing dependency that evalite has on vitest. Let me look at the current
  state before touching anything.

  Read 2 files (ctrl+o to expand)

⏺ Now let me understand exactly how evalite references vitest so I declare the right kind of dependency (peer vs runtime).

  Searched for 3 patterns, read 1 file (ctrl+o to expand)

⏺ evalite's runtime code imports from vitest but only declares @vitest/runner and @vitest/utils as deps — never vitest itself. Let me confirm it's the
  runtime files (not just tests) that need it:

⏺ Bash(cd node_modules/.pnpm/evalite@0.19.0/node_modules/evalite/dist; for f in evalite.js run-evalite.js reporter.js; do echo "== $f =="; grep -n "from
      \"vitest\"" "$…)
  ⎿  == evalite.js ==
     3:import { describe, inject, it } from "vitest";

⏺ Confirmed — this is a genuine phantom dependency. evalite/dist/evalite.js (the entry your my-eval.eval.ts pulls describe/it/inject from) imports from
  "vitest", yet evalite's package.json only declares @vitest/runner and @vitest/utils, never vitest itself. With hoist: false + strictPeerDependencies:
  true, evalite can't resolve vitest from its own tree.

  The clean fix is pnpm's packageExtensions (supported directly in pnpm-workspace.yaml), patching evalite's manifest to declare the peer it actually
  needs. I'll pin it to ^4 to match evalite's own @vitest/* deps and your catalog's vitest: ^4.1.8.

⏺ Update(pnpm-workspace.yaml)
  ⎿  Added 4 lines
      21  minimumReleaseAge: 10080
      22  minimumReleaseAgeIgnoreMissingTime: true
      23  minimumReleaseAgeStrict: true
      24 +packageExtensions:                                                                                                                     
      25 +  evalite:                                                                                                                             
      26 +    peerDependencies:                                                                                                                  
      27 +      vitest: ^4.0.0                                                                                                                   
      28  packages:
      29    - 0-meta/*
      30    - 1-isomorphic/*

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pnpm-workspace.yaml and the evalite package manifest, then inspect evalite/dist/evalite.js where the issue reports an import from vitest. Reproduce the failure with pnpm configured for no hoisting and strict peer dependencies. Done means evalite resolves vitest without the phantom-dependency error under that configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.