MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / getTestExecutionInfo

Function getTestExecutionInfo

src/shared/utils/test.ts:100–112  ·  view source on GitHub ↗
(programPath: string, tests: TestSelection[], shouldRunTestByLine: boolean)

Source from the content-addressed store, hash-verified

98}
99
100export function getTestExecutionInfo(programPath: string, tests: TestSelection[], shouldRunTestByLine: boolean): { programUri: URI, args: string[] } {
101 if (shouldRunTestByLine && tests.length && tests.every((test) => test.position)) {
102 return {
103 // VS Code lines are 0-based, but Dart is 1-based.
104 args: tests.slice(1).map(((test) => `${programPath}?line=${test.position!.line + 1}`)),
105 programUri: URI.file(programPath).with({ query: `?line=${tests[0].position!.line + 1}` }),
106 };
107 }
108 return {
109 args: ["--name", makeRegexForTests(tests)],
110 programUri: URI.file(programPath),
111 };
112}
113
114export function getProgramString(programUri: URI) {
115 return programUri.query ? `${fsPath(programUri)}${programUri.query}` : fsPath(programUri);

Callers 1

getLaunchConfigFunction · 0.85

Calls 1

makeRegexForTestsFunction · 0.85

Tested by

no test coverage detected