From 4c96ebc9f34116529cdc56a86bf061f2f49e6a2d Mon Sep 17 00:00:00 2001 From: issacto Date: Mon, 21 Aug 2023 12:16:12 +0100 Subject: [PATCH] add test tree -3 Signed-off-by: issacto --- vs code extension/client/src/extension.ts | 16 +++++++++------- .../client/src/services/TestTree.ts | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/vs code extension/client/src/extension.ts b/vs code extension/client/src/extension.ts index a8a67b30..424645ac 100644 --- a/vs code extension/client/src/extension.ts +++ b/vs code extension/client/src/extension.ts @@ -125,13 +125,14 @@ export function activate(context: ExtensionContext) { run.enqueued(test); queue.push({ test, data }); } else { - if (data instanceof TestFile ) { + if (data instanceof TestFile ) { await data.updateFromDisk(ctrl, test); } await discoverTests(gatherTestItems(test)); + } - if(data instanceof TestFile && test.children.size!=0 ) + if(!(data instanceof TestFile) || !data.isDirectory(test.uri.fsPath)) { if (test.uri && !coveredLines.has(test.uri.toString())) { try { @@ -251,9 +252,10 @@ function createDirItems( controller:vscode.TestController, uri: vscode.Uri){ if(!controller.items.get(rootUri)){ file = controller.createTestItem(rootUri, dirArr[0], tmpUri); controller.items.add(file); - data = new TestFile() - testData.set(file, data); + data = new TestFile(); file.canResolveChildren = true; + testData.set(file, data); + } else{ file = controller.items.get(rootUri) @@ -266,17 +268,17 @@ function createDirItems( controller:vscode.TestController, uri: vscode.Uri){ var tmpDir = rootUri var tmpFile = null var tmpData = null - for(var i =1;i { const start = Date.now(); - await new Promise(resolve => setTimeout(resolve, 1000 + Math.random() * 1000)); + await new Promise(resolve => setTimeout(resolve, 1 + Math.random() * 1)); const duration = Date.now() - start; options.passed(item, duration);