fix: properly handle negated timed-out `toPass` matcher (#19580)
This commit is contained in:
Родитель
bb2a2c7331
Коммит
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);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче