Skip to content

Commit bb48477

Browse files
committed
Merge branch 'topic/e3-testsuite-vscode' into 'master'
Implement e3-testsuite integration in VS Code See merge request eng/ide/ada_language_server!2038
2 parents 9a73bf2 + cfb0d80 commit bb48477

File tree

12 files changed

+1484
-131
lines changed

12 files changed

+1484
-131
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ include:
8686
cpus: 4
8787
disk: 80
8888
windows: true
89+
windows-cpus: 4
8990
rules:
9091
# integration-testsuite cannot work with edge builds
9192
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_TARGET_BRANCH_NAME == 'edge'

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ section below it for the last release. -->
99
* `Go to Definition` now jumps respectively on the `begin`, `private` and `body` keywords
1010
for subprograms, packages and tasks when clicking on the `is` keyword following their declarations
1111
* New refactoring: [Delete Entity](https://github.com/AdaCore/ada_language_server/blob/master/doc/refactoring_tools.md#delete-entity)
12+
* Provide an integration of the [e3-testsuite](https://github.com/AdaCore/e3-testsuite) framework with the VS Code testing UI
1213

1314
## 26.0.202507021
1415

integration/vscode/ada/.vscode-test.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const testsuites = [
5151
'dot-als-json',
5252
'status_bar',
5353
'aggregate_projects',
54+
'e3-testsuite',
5455
];
5556

5657
export default defineConfig(
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""
2+
The purpose of this module is to report e3-testsuite events to the Ada & SPARK VS Code
3+
extension.
4+
5+
It provides a callback to be used with the e3-testsuite notification system via the
6+
--notify-events CLI argument. See the documentation of the
7+
`e3.testsuite.event_notifications` module for more information about that system.
8+
9+
Upon receiving e3-testsuite events, the callback prints them to stdout, as JSON objects
10+
of a specific structure expected by the Ada & SPARK VS Code extension. That structure is
11+
defined by the `TestsuiteNotification` type in `e3TestsuiteNotifications.ts`.
12+
"""
13+
14+
import json
15+
import os
16+
import sys
17+
from typing import Literal, NotRequired, TypedDict
18+
19+
from e3.testsuite import Testsuite
20+
from e3.testsuite import event_notifications as EN
21+
from e3.testsuite.event_notifications import TestNotification
22+
23+
NotificationType = Literal["queue", "start", "result", "end"]
24+
25+
26+
class Event(TypedDict):
27+
kind: NotificationType
28+
testName: str
29+
resultPath: NotRequired[str]
30+
31+
32+
def callback(e: TestNotification):
33+
if isinstance(e, EN.TestQueueNotification):
34+
v = Event(kind="queue", testName=e.test_name)
35+
elif isinstance(e, EN.TestStartNotification):
36+
v = Event(kind="start", testName=e.test_name)
37+
elif isinstance(e, EN.TestResultNotification):
38+
v = Event(
39+
kind="result", testName=e.test_name, resultPath=e.yaml_result_filename
40+
)
41+
elif isinstance(e, EN.TestEndNotification):
42+
v = Event(kind="end", testName=e.test_name)
43+
else:
44+
v = None
45+
46+
if v is not None:
47+
json.dump(v, sys.stdout)
48+
sys.stdout.write(os.linesep)
49+
sys.stdout.flush()
50+
51+
52+
def init_callback(ts: Testsuite):
53+
return callback

integration/vscode/ada/package-lock.json

Lines changed: 35 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/vscode/ada/package.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"workspaceContains:*.ad[bs]",
2323
"workspaceContains:*/*.ad[bs]",
2424
"workspaceContains:alire.toml",
25+
"workspaceContains:testsuite.py",
26+
"workspaceContains:*/testsuite.py",
2527
"onDebugDynamicConfigurations:ada"
2628
],
2729
"main": "./out/src/extension",
@@ -710,6 +712,26 @@
710712
"description": "Enable experimental features still in development."
711713
}
712714
}
715+
},
716+
{
717+
"title": "e3-testsuite",
718+
"properties": {
719+
"e3-testsuite.testsuitePath": {
720+
"type": "string",
721+
"description": "Path to testsuite.py",
722+
"default": "testsuite.py"
723+
},
724+
"e3-testsuite.python": {
725+
"type": "string",
726+
"description": "Path to python interpreter, useful when you want to use a specific venv",
727+
"default": "python"
728+
},
729+
"e3-testsuite.args": {
730+
"type": "array",
731+
"description": "Command line arguments to pass to testsuite.py when running tests",
732+
"default": []
733+
}
734+
}
713735
}
714736
],
715737
"jsonValidation": [
@@ -1465,6 +1487,8 @@
14651487
"@types/node": "^18.0.0",
14661488
"@types/react": "^19.0.10",
14671489
"@types/react-dom": "^19.0.4",
1490+
"@types/split2": "^4.2.3",
1491+
"@types/tmp": "^0.2.6",
14681492
"@types/vscode": "~1.88.0",
14691493
"@types/vscode-webview": "^1.57.5",
14701494
"@types/ws": "^8.0.0",
@@ -1532,8 +1556,11 @@
15321556
"process": "0.11.10",
15331557
"react": "^19.0.0",
15341558
"react-dom": "^19.0.0",
1559+
"split2": "^4.2.0",
1560+
"tmp": "^0.2.3",
15351561
"vscode-languageclient": "9.0.1",
15361562
"winston": "3.14.2",
1537-
"ws": "^8.18.0"
1563+
"ws": "^8.18.0",
1564+
"yaml": "^2.8.0"
15381565
}
15391566
}

0 commit comments

Comments
 (0)