cherry-pick(#19580): fix: properly handle negated timed-out toPass matcher
This commit is contained in:
parent
efa3756c16
commit
d10cc91cf6
|
|
@ -358,5 +358,5 @@ export async function toPass(
|
||||||
`- ${timeoutMessage}`,
|
`- ${timeoutMessage}`,
|
||||||
].join('\n') : 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(stripAnsi(result.output)).toContain('Received: 2');
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
expect(result.failed).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 a new issue