Skip to content

Commit e6cb96c

Browse files
committed
Start handling docker-compose case
1 parent 7f73d0f commit e6cb96c

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/commonRunTestsHandler.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
4545
if (test.uri.scheme === "file") {
4646
// Client-side editing, for which we will assume objectscript.conn names a server defined in `intersystems.servers`
4747
const conn: any = vscode.workspace.getConfiguration("objectscript", test.uri).get("conn");
48-
authority = conn.server + ":" + (conn.ns as string).toLowerCase();
48+
authority = (conn.server || "") + ":" + (conn.ns as string).toLowerCase();
4949
const folder = vscode.workspace.getWorkspaceFolder(test.uri);
5050
if (folder) {
5151
key = key.slice(folder.uri.path.length + relativeTestRoot(folder).length + 1);
@@ -89,7 +89,8 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
8989
'Test Results',
9090
true
9191
);
92-
const authority = mapInstance[0];
92+
let authority = mapInstance[0];
93+
let query = "";
9394
const mapTestClasses = mapInstance[1];
9495
const firstClassTestItem = Array.from(mapTestClasses.values())[0];
9596
const oneUri = firstClassTestItem.uri;
@@ -126,7 +127,14 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
126127
}
127128

128129
const username: string = server.username || 'UnknownUser';
129-
const testRoot = vscode.Uri.from({ scheme: 'isfs', authority, path: `/.vscode/UnitTestRoot/${username}` });
130+
131+
// When client-side mode is using 'objectscript.conn.docker-compose the first piece of 'authority' is blank,
132+
if (authority.startsWith(":")) {
133+
const namespace = authority.slice(1).toUpperCase();
134+
query = `ns=${encodeURIComponent(namespace)}`;
135+
authority = folder?.name || "";
136+
}
137+
const testRoot = vscode.Uri.from({ scheme: 'isfs', authority, path: `/.vscode/UnitTestRoot/${username}`, query });
130138
try {
131139
// Limitation of the Atelier API means this can only delete the files, not the folders
132140
// but zombie folders shouldn't cause problems.

src/localTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function replaceLocalRootItems(controller: vscode.TestController) {
9999
vscode.workspace.workspaceFolders?.forEach(folder => {
100100
if (folder.uri.scheme === 'file') {
101101
const server = osAPI.serverForUri(folder.uri);
102-
if (server?.serverName && server.namespace) {
102+
if (server?.namespace) {
103103
const key = server.serverName + ":" + server.namespace + ":";
104104
if (!rootMap.has(key)) {
105105
const relativeRoot = relativeTestRoot(folder);

0 commit comments

Comments
 (0)