Skip to content

Commit c409840

Browse files
committed
Make Recent History tree work for client-side mode
1 parent 8af46b3 commit c409840

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Hovering on a run's folder reveals an action button which launches %UnitTest's o
104104
This extension is a preview and has some known limitations:
105105

106106
- The extension uses server-side REST support for debugging even when tests are not being debugged. That support is broken in InterSystems IRIS 2021.1.3, and maybe also in earlier 2021.1.x versions.
107+
- In client-side mode test-run results don't update the testing icons in the editor gutter or the Local Tests tree in Testing view. Workaround is to view them under the Recent History tree.
107108
- Debugging tests in client-side mode has issues arising from how your workspace stores your test classes outside the source tree of the classes they are testing. Please see the extension's repository (link below) and add new issues if you experience problems not already logged there.
108109
- The extension has only been tested with InterSystems IRIS instances that use the English locale. Its technique for parsing the output from %UnitTest is likely to fail with other locales.
109110
- The `/autoload` feature of %UnitTest is not supported. This is only relevant to client-side mode.

src/historyExplorer.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,24 @@ export async function setupHistoryExplorerController() {
4747
}
4848

4949
export async function serverSpec(item: vscode.TestItem): Promise<IServerSpec | undefined> {
50-
return await smAPI.getServerSpec(item.id.split(':')[0]);
50+
const serverName = item.id.split(':')[0];
51+
if (serverName) {
52+
return await smAPI.getServerSpec(serverName);
53+
}
54+
else {
55+
const server = osAPI.serverForUri(item.uri);
56+
const serverSpec: IServerSpec = {
57+
username: server.username,
58+
name: server.serverName,
59+
webServer: {
60+
host: server.host,
61+
port: server.port,
62+
pathPrefix: server.pathPrefix,
63+
scheme: server.scheme
64+
}
65+
};
66+
return serverSpec;
67+
}
5168
}
5269

5370
async function addTestInstances(item: vscode.TestItem, controller: vscode.TestController) {
@@ -244,7 +261,7 @@ export function replaceRootItems(controller: vscode.TestController, schemes?: st
244261
vscode.workspace.workspaceFolders?.forEach(folder => {
245262
if (!schemes || schemes.includes(folder.uri.scheme)) {
246263
const server = osAPI.serverForUri(folder.uri);
247-
if (server?.serverName && server.namespace) {
264+
if (server.namespace) {
248265
const key = server.serverName + ":" + server.namespace.toUpperCase();
249266
if (!rootMap.has(key)) {
250267
const item = controller.createTestItem(key, key, folder.uri);

0 commit comments

Comments
 (0)