-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
60 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,6 @@ | |
"license": "ISC", | ||
"devDependencies": { | ||
"vite": "^2.8.6", | ||
"vitest": "^0.6.0" | ||
"vitest": "^0.6.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as vscode from "vscode"; | ||
import { TestRunner } from "./pure/runner"; | ||
import { getAllTestCases, testData, getTestCaseId } from "./test_data"; | ||
|
||
export async function runTest( | ||
runner: TestRunner, | ||
run: vscode.TestRun, | ||
item: vscode.TestItem | ||
) { | ||
const testCases = new Set(getAllTestCases(item)); | ||
const idMap = new Map<string, vscode.TestItem>(); | ||
testCases.forEach((testCase) => { | ||
run.started(testCase); | ||
idMap.set(testCase.id, testCase); | ||
}); | ||
|
||
const data = testData.get(item)!; | ||
const out = await runner.scheduleRun(item.uri!.fsPath, data.pattern); | ||
console.log(out.testResults); | ||
out.testResults.forEach((result) => { | ||
const id = getTestCaseId(item, result.displayName!) || ""; | ||
const child = idMap.get(id); | ||
if (!child) { | ||
return; | ||
} | ||
|
||
testCases.delete(child); | ||
switch (result.status) { | ||
case "pass": | ||
run.passed(child, result.perfStats?.runtime); | ||
return; | ||
case "fail": | ||
run.failed(child, new vscode.TestMessage(result.failureMessage || "")); | ||
return; | ||
} | ||
|
||
if (result.skipped || result.status == null) { | ||
run.skipped(child); | ||
} | ||
}); | ||
|
||
testCases.forEach((testCase) => { | ||
run.skipped(testCase); | ||
run.appendOutput(`Cannot find test ${testCase.id}`); | ||
}); | ||
|
||
run.end(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters