Address remaining review comments for peer dependency warnings

Test improvements:
- Line 7681: Use line-anchored regex pattern /^warn:[^\n]*...$/ to
  match only single lines (same fix as line 3916)

Regression test 26076 rewrite:
- Remove setDefaultTimeout and use local VerdaccioRegistry instead
  of network npm to make test hermetic and fast
- Fix await order: await stdout/stderr BEFORE exited for better
  error messages on failure
- Update regex pattern to support scoped packages and hyphenated
  names using /[@\w./-]+/ instead of /\w+/
- Publish test packages locally to create controlled peer dep
  mismatch scenario

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2026-01-15 00:29:39 +00:00
parent 669ffe3749
commit 06a21e8c19
2 changed files with 65 additions and 36 deletions

View File

@@ -7678,7 +7678,10 @@ describe("yarn tests", () => {
expect(err).not.toContain("error:");
expect(err).not.toContain("not found");
// New improved peer dependency warning format shows the requiring package, expected version, and actual version
expect(err).toMatch(/warn:.*peer-deps-fixed has unmet peer dependency no-deps@\^1\.0\.0 \(found 2\.0\.0\)/);
// Use line-anchored pattern to avoid matching across lines
expect(err).toMatch(
/^warn:[^\n]*peer-deps-fixed[^\n]*has unmet peer dependency no-deps@\^1\.0\.0 \(found 2\.0\.0\)$/m,
);
expect(out.replace(/\s*\[[0-9\.]+m?s\]\s*$/, "").split(/\r?\n/)).toEqual([
expect.stringContaining("bun install v1."),
"",