mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
chore: restore expect.any()/expect.anything() (#12820)
This commit is contained in:
parent
bb68875e82
commit
e231db1810
@ -34,6 +34,8 @@ export declare type Expect = {
|
||||
extend(arg0: any): void;
|
||||
getState(): expect.MatcherState;
|
||||
setState(state: Partial<expect.MatcherState>): void;
|
||||
any(expectedObject: any): AsymmetricMatcher;
|
||||
anything(): AsymmetricMatcher;
|
||||
arrayContaining(sample: Array<unknown>): AsymmetricMatcher;
|
||||
objectContaining(sample: Record<string, unknown>): AsymmetricMatcher;
|
||||
stringContaining(expected: string): AsymmetricMatcher;
|
||||
@ -43,8 +45,6 @@ export declare type Expect = {
|
||||
* - assertions()
|
||||
* - extractExpectedAssertionsErrors()
|
||||
* – hasAssertions()
|
||||
* - any()
|
||||
* - anything()
|
||||
*/
|
||||
};
|
||||
|
||||
|
@ -118,17 +118,31 @@ test('should include custom error message with web-first assertions', async ({ r
|
||||
].join('\n'));
|
||||
});
|
||||
|
||||
test('should work with default expect prototype functions', async ({ runTSC }) => {
|
||||
const result = await runTSC({
|
||||
'a.spec.ts': `
|
||||
const { test } = pwt;
|
||||
test('should work with default expect prototype functions', async ({ runTSC, runInlineTest }) => {
|
||||
const spec = `
|
||||
const { test } = pwt;
|
||||
test('pass', async () => {
|
||||
const expected = [1, 2, 3, 4, 5, 6];
|
||||
test.expect([4, 1, 6, 7, 3, 5, 2, 5, 4, 6]).toEqual(
|
||||
expect.arrayContaining(expected),
|
||||
);
|
||||
`
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect('foo').toEqual(expect.any(String));
|
||||
expect('foo').toEqual(expect.anything());
|
||||
});
|
||||
`;
|
||||
{
|
||||
const result = await runTSC({
|
||||
'a.spec.ts': spec,
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
}
|
||||
{
|
||||
const result = await runInlineTest({
|
||||
'a.spec.ts': spec,
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
}
|
||||
});
|
||||
|
||||
test('should work with default expect matchers', async ({ runTSC }) => {
|
||||
|
@ -241,7 +241,8 @@ const TSCONFIG = {
|
||||
'esModuleInterop': true,
|
||||
'allowSyntheticDefaultImports': true,
|
||||
'rootDir': '.',
|
||||
'lib': ['esnext', 'dom', 'DOM.Iterable']
|
||||
'lib': ['esnext', 'dom', 'DOM.Iterable'],
|
||||
'noEmit': true,
|
||||
},
|
||||
'exclude': [
|
||||
'node_modules'
|
||||
|
Loading…
Reference in New Issue
Block a user