test: fix a broken reporter test (#29514)

It failed to print an error with missing stack, e.g. a timeout error.
This commit is contained in:
Dmitry Gozman 2024-02-15 09:45:48 -08:00 committed by GitHub
parent 09d0a099a2
commit bc2d4302f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,8 +47,8 @@ class Reporter {
distillError(error) {
return {
error: {
message: stripAnsi(error.message),
stack: stripAnsi(error.stack),
message: stripAnsi(error.message || ''),
stack: stripAnsi(error.stack || ''),
}
};
}
@ -351,6 +351,12 @@ test('should not report nested after hooks', async ({ runInlineTest }) => {
},
],
},
{
error: {
message: 'Test timeout of 2000ms exceeded.',
stack: ''
},
},
]);
});
@ -972,6 +978,18 @@ test('should not mark page.close as failed when page.click fails', async ({ runI
},
],
},
{
error: {
message: 'Test timeout of 2000ms exceeded.',
stack: '',
},
},
{
error: {
message: expect.stringContaining('Error: page.click'),
stack: expect.stringContaining('Error: page.click'),
},
},
]);
});
@ -1172,7 +1190,7 @@ test('should propagate nested soft errors', async ({ runInlineTest }) => {
expect.soft(1).toBe(2);
});
});
await test.step('second outer', async () => {
await test.step('second inner', async () => {
expect(1).toBe(2);
@ -1267,7 +1285,7 @@ test('should not propagate nested hard errors', async ({ runInlineTest }) => {
}
});
});
await test.step('second outer', async () => {
await test.step('second inner', async () => {
expect(1).toBe(2);