Skip to content

phantom dependency from evalite to vitest #398

Description

@Yvem

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions