toMatch

Bun

Symbol

MatchersBuiltin.toMatch

toMatch(expected: string | RegExp): void

Asserts that a value matches a regular expression or includes a substring.

@param expected

the expected substring or pattern.

expect("dog").toMatch(/dog/);
expect("dog").toMatch("og");