mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-30 23:45:33 +03:00
fix: properly handle negated timed-out toPass
matcher (#19580)
This commit is contained in:
parent
bb2a2c7331
commit
d7e7cab44a
@ -358,5 +358,5 @@ export async function toPass(
|
||||
`- ${timeoutMessage}`,
|
||||
].join('\n') : timeoutMessage;
|
||||
|
||||
return { message, pass: false };
|
||||
return { message, pass: isNot ? true : false };
|
||||
}
|
||||
|
@ -166,4 +166,17 @@ test('should work with soft', async ({ runInlineTest }) => {
|
||||
expect(stripAnsi(result.output)).toContain('Received: 2');
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.failed).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
test('should not accept TimeoutError', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'a.spec.ts': `
|
||||
const { test } = pwt;
|
||||
test('should fail', async () => {
|
||||
await test.expect(() => {}).not.toPass({ timeout: 1 });
|
||||
});
|
||||
`
|
||||
});
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.failed).toBe(1);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user