diff --git a/news/2 Fixes/17270.md b/news/2 Fixes/17270.md new file mode 100644 index 000000000000..fe0c948a4d71 --- /dev/null +++ b/news/2 Fixes/17270.md @@ -0,0 +1 @@ +Fix for test result not found for files starting with py. diff --git a/src/client/testing/testController/common/resultsHelper.ts b/src/client/testing/testController/common/resultsHelper.ts index 0b35d7411c1d..7eaceeb398d0 100644 --- a/src/client/testing/testController/common/resultsHelper.ts +++ b/src/client/testing/testController/common/resultsHelper.ts @@ -97,7 +97,7 @@ export async function updateResultFromJunitXml( } const result = junitSuite.testcase.find((t) => { - const idResult = getRunIdFromRawData(`${t.$.classname}.${t.$.name}`); + const idResult = getRunIdFromRawData(`${t.$.classname}::${t.$.name}`); const idNode = rawTestCaseNode.runId; return idResult === idNode || idNode.endsWith(idResult); }); diff --git a/src/client/testing/testController/common/testItemUtilities.ts b/src/client/testing/testController/common/testItemUtilities.ts index b20b8da4fac4..17bd171bbc50 100644 --- a/src/client/testing/testController/common/testItemUtilities.ts +++ b/src/client/testing/testController/common/testItemUtilities.ts @@ -88,9 +88,12 @@ function getRangeFromRawSource(raw: { source: string }): Range | undefined { } export function getRunIdFromRawData(id: string): string { + // TODO: This is a temporary solution to normalize test ids. + // The current method is error prone and easy to break. When we + // re-write the test adapters we should make sure we consider this. // This is the id that will be used to compare with the results. const runId = id - .replace(/\.py/g, '') + .replace(/\.py[^\w\-]/g, '') // we want to get rid of the `.py` in file names .replace(/[\\\:\/]/g, '.') .replace(/\:\:/g, '.') .replace(/\.\./g, '.');