mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
unit tests - help diagnose test failure reason for web tests (#155967)
This commit is contained in:
parent
0c4187895d
commit
86e7410278
|
@ -150,6 +150,8 @@ async function runTestsInBrowser(testModules, browserType) {
|
|||
const failingModuleIds = [];
|
||||
const failingTests = [];
|
||||
emitter.on('fail', (test, err) => {
|
||||
failingTests.push({ title: test.fullTitle, message: err.message });
|
||||
|
||||
if (err.stack) {
|
||||
const regex = /(vs\/.*\.test)\.js/;
|
||||
for (const line of String(err.stack).split('\n')) {
|
||||
|
@ -160,9 +162,6 @@ async function runTestsInBrowser(testModules, browserType) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We could not determine the module id
|
||||
failingTests.push(test.fullTitle);
|
||||
});
|
||||
|
||||
try {
|
||||
|
@ -176,11 +175,14 @@ async function runTestsInBrowser(testModules, browserType) {
|
|||
}
|
||||
await browser.close();
|
||||
|
||||
if (failingModuleIds.length > 0) {
|
||||
return `to DEBUG, open ${browserType.toUpperCase()} and navigate to ${target.href}?${failingModuleIds.map(module => `m=${module}`).join('&')}`;
|
||||
}
|
||||
if (failingTests.length > 0) {
|
||||
return `The followings tests are failing:\n - ${failingTests.join('\n - ')}`;
|
||||
let res = `The followings tests are failing:\n - ${failingTests.map(({ title, message }) => `${title} (reason: ${message})`).join('\n - ')}`;
|
||||
|
||||
if (failingModuleIds.length > 0) {
|
||||
res += `\n\nTo DEBUG, open ${browserType.toUpperCase()} and navigate to ${target.href}?${failingModuleIds.map(module => `m=${module}`).join('&')}`;
|
||||
}
|
||||
|
||||
return `${res}\n`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue