chore: test node_modules symlinks in npm workspace with cyclic deps (#34759)
Adds a regression spec test for the npm-workspace symlink scenario
reported in #19726.
## Background
The issue reported that an npm workspace where member packages are
symlinked into `node_modules` (as `npm install` does) caused Rust to
panic during package.json module resolution. The reproduction
(verikono/deno-npm-symlinks) has three workspace packages where `pkg-a`
and `pkg-b` import each other (a cyclic dependency).
This was fixed somewhere along the way — the maintainer noted on the
issue that it already works in v2.1.2, and I confirmed it works on
current `main` across every resolution path I tried:
- import-map resolution to the local workspace sources
- pure `node_modules` + package.json `exports` resolution
(`nodeModulesDir: manual`)
- absolute symlinks pointing outside the project root
- cyclic deps via `deno run`, `deno test` (type-check + run), and `deno
info` (which correctly canonicalizes the symlink to the real path and
shows the cycle)
## This PR
Since there was no code left to fix, this adds a regression spec test at
`tests/specs/npm/workspace_symlink_cyclic/` so the scenario doesn't
regress. The test:
- sets up an npm workspace with `main-project`, `pkg-a`, `pkg-b` (with
`pkg-a` ⇄ `pkg-b` cyclic deps), mirroring the original reproduction
- recreates the `node_modules` symlinks `npm install` produces, via a
`setup.js` step using `Deno.symlinkSync` (no symlinks committed to git)
- runs `deno test`, which resolves the symlinked workspace packages
through `node_modules` and exercises the cyclic dependency
Gated to `unix` since creating directory symlinks on Windows requires
elevated privileges.
Closes #19726
Closes denoland/divybot#440
---------
Co-authored-by: divybot <divybot@users.noreply.github.com>
Co-authored-by: Divy Srivastava <me@littledivy.com>