This PR cherry-picks the following commits:
- c9eac69f2b
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
6155a50190
commit
20427b9b92
|
|
@ -418,7 +418,7 @@ expect(value).toMatches(/Is \d+ enough/);
|
||||||
|
|
||||||
### param: GenericAssertions.toMatch.expected
|
### param: GenericAssertions.toMatch.expected
|
||||||
* since: v1.9
|
* since: v1.9
|
||||||
- `expected` <[RegExp]>
|
- `expected` <[RegExp]|[string]>
|
||||||
|
|
||||||
Regular expression to match against.
|
Regular expression to match against.
|
||||||
|
|
||||||
|
|
|
||||||
2
packages/playwright-test/types/test.d.ts
vendored
2
packages/playwright-test/types/test.d.ts
vendored
|
|
@ -4095,7 +4095,7 @@ interface GenericAssertions<R> {
|
||||||
*
|
*
|
||||||
* @param expected Regular expression to match against.
|
* @param expected Regular expression to match against.
|
||||||
*/
|
*/
|
||||||
toMatch(expected: RegExp): R;
|
toMatch(expected: RegExp | string): R;
|
||||||
/**
|
/**
|
||||||
* Compares contents of the value with contents of `expected`, performing "deep equality" check. Allows extra
|
* Compares contents of the value with contents of `expected`, performing "deep equality" check. Allows extra
|
||||||
* properties to be present in the value, unlike
|
* properties to be present in the value, unlike
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,7 @@ test('should work with generic matchers', async ({ runTSC }) => {
|
||||||
expect({}).toEqual({});
|
expect({}).toEqual({});
|
||||||
expect([1, 2]).toHaveLength(2);
|
expect([1, 2]).toHaveLength(2);
|
||||||
expect('abc').toMatch(/a.?c/);
|
expect('abc').toMatch(/a.?c/);
|
||||||
|
expect('abc').toMatch('abc');
|
||||||
expect({ a: 1, b: 2 }).toMatchObject({ a: 1 });
|
expect({ a: 1, b: 2 }).toMatchObject({ a: 1 });
|
||||||
expect({}).toStrictEqual({});
|
expect({}).toStrictEqual({});
|
||||||
expect(() => { throw new Error('Something bad'); }).toThrow('something');
|
expect(() => { throw new Error('Something bad'); }).toThrow('something');
|
||||||
|
|
|
||||||
2
utils/generate_types/overrides-test.d.ts
vendored
2
utils/generate_types/overrides-test.d.ts
vendored
|
|
@ -297,7 +297,7 @@ interface GenericAssertions<R> {
|
||||||
toEqual(expected: unknown): R;
|
toEqual(expected: unknown): R;
|
||||||
toHaveLength(expected: number): R;
|
toHaveLength(expected: number): R;
|
||||||
toHaveProperty(keyPath: string | Array<string>, value?: unknown): R;
|
toHaveProperty(keyPath: string | Array<string>, value?: unknown): R;
|
||||||
toMatch(expected: RegExp): R;
|
toMatch(expected: RegExp | string): R;
|
||||||
toMatchObject(expected: Record<string, unknown> | Array<unknown>): R;
|
toMatchObject(expected: Record<string, unknown> | Array<unknown>): R;
|
||||||
toStrictEqual(expected: unknown): R;
|
toStrictEqual(expected: unknown): R;
|
||||||
toThrow(error?: unknown): R;
|
toThrow(error?: unknown): R;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue