mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Fix regex to match dependency paths with special characters
Update the regex in the regression test to use [^\n]+ instead of [@\w./-]+ to match dependency paths that contain parentheses, angle brackets, and spaces (e.g., "(root) > peer-deps-fixed"). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,9 +72,10 @@ describe("issue #26076 - peer dependency warnings", () => {
|
||||
expect(stderr).toContain("no-deps@^1.0.0");
|
||||
expect(stderr).toContain("(found 2.0.0)");
|
||||
|
||||
// Verify the full format with regex - supports scoped packages and hyphenated names
|
||||
// Pattern matches: "warn: ... <package-name> has unmet peer dependency <dep>@<version> (found <version>)"
|
||||
expect(stderr).toMatch(/(?:warn:\s*)?[@\w./-]+ has unmet peer dependency [@\w./-]+@\S+ \(found \S+\)/);
|
||||
// Verify the full format with regex - supports dependency paths like "(root) > peer-deps-fixed"
|
||||
// Pattern matches: "warn: ... has unmet peer dependency <dep>@<version> (found <version>)"
|
||||
// Use [^\n]* to match any characters in the dependency path (including parentheses, >, spaces)
|
||||
expect(stderr).toMatch(/(?:warn:\s*)?[^\n]+ has unmet peer dependency [@\w./-]+@\S+ \(found \S+\)/);
|
||||
|
||||
expect(exitCode).toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user