Skip to content

Commit 4563e54

Browse files
committed
Merge branch 'topic/shorten-vscode-test-names' into 'master'
Create a tool to convert Mocha JUnit to e3.testsuite report Closes #1389 See merge request eng/ide/ada_language_server!1631
2 parents fe6d77d + c251e1e commit 4563e54

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

integration/vscode/ada/.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ tsconfig.json
1616
**/*.ts.map
1717
xfail.yaml
1818
vscode-test-win-workaround.py
19+
convert-mocha-junit-report.py
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! env python
2+
"""This tool wraps around the e3.testsuite XUnit report import feature to customize test
3+
naming based on the reports obtained in VS Code testing from the mocha-junit-reporter
4+
module."""
5+
6+
from e3.testsuite.report.xunit import XUnitImporter, XUnitImporterApp
7+
8+
9+
class XUnitImporterCustomTestNaming(XUnitImporter):
10+
def get_test_name(
11+
self,
12+
testsuite_name: str,
13+
testcase_name: str,
14+
classname: str | None = None,
15+
) -> str:
16+
"""Override naming scheme to ignore the testcase name because it
17+
duplicates the information from the testsuite name and the classname
18+
attribute."""
19+
return super().get_test_name(testsuite_name, "", classname)
20+
21+
22+
class MochaJUnitImporterApp(XUnitImporterApp):
23+
24+
def create_importer(self) -> XUnitImporter:
25+
return XUnitImporterCustomTestNaming(self.index, self.xfails)
26+
27+
28+
if __name__ == "__main__":
29+
MochaJUnitImporterApp().run()

0 commit comments

Comments
 (0)