Change:
Guessing this is because of the conditionals? It detects them fine, but doesn't run. They run fine if I add to the suite and !
Yes, we use an to extract tests from files. It doesn't doing any evaluation. Not sure that I want to open that can of worms
but it detects the tests as seen on the left side, so why isn't it able to run it if it knows the test name?
The identity of a test is formed by joining the containing file name and its name with the path of containing suites' names. The extension detects the suite but it does not recognize that it's a child of . When tests are run it's expecting updates to a test named , but it doesn't get that so it's marked as skipped.
I clicked run on though, so can't we run everything matching in that case?
It does run everything, and you should see that in the test output, but it doesn't associate the results with the tests. It expects to get results for but it actually gets , which is not a path to any test the extension knows about.
Could we be a little smarter in matching these up if there's a simple 1:1 match up? Like checking that expected items have matching prefixes and suffixes and there's no ambiguity? I don't expect this to work if we're generating tests with a loop (though that would be nice), if we can exactly match up the amount of tests to that expected then it should be safe?
Eh, I'll just add some logic to identify simple ternary expressions like these

Discussion:
import { TestCase, TestConstruct, TestSuite, VSCodeTest } from './testTree'; const suiteNames = new Set(['suite', 'flakySuite']); <ins> const testNames = new Set(['test']); </ins> export const enum Action { Skip,

return Action.Recurse; } <del> let lhs = node.expression; if (isSkipCall(lhs)) { </del> <ins> const asSuite = identifyCall(node.expression, suiteNames); const asTest = identifyCall(node.expression, testNames); const either = asSuite || asTest; if (either === IdentifiedCall.Skipped) { </ins> return Action.Skip; } <del> if (isPropertyCall(lhs) && lhs.name.text === 'only') { lhs = lhs.expression; </del> <ins> if (either === IdentifiedCall.Nothing) { return Action.Recurse; </ins> } const name = node.arguments[0]; const func = node.arguments[1]; <del> if (!name || !ts.isIdentifier(lhs) || !ts.isStringLiteralLike(name)) { return Action.Recurse; } if (!func) { </del> <ins> if (!name || !ts.isStringLiteralLike(name) || !func) { </ins> return Action.Recurse; }

); const cparent = parent instanceof TestConstruct ? parent : undefined; <del> if (lhs.escapedText === 'test') { </del> <ins> // we know this is either a suite or a test because we checked for skipped/nothing above if (asTest) { </ins> return new TestCase(name.text, range, cparent); } <del> if (suiteNames.has(lhs.escapedText.toString())) { </del> <ins> if (asSuite) { </ins> return new TestSuite(name.text, range, cparent); } <del> return Action.Recurse; </del> <ins> throw new Error('unreachable'); }; const enum IdentifiedCall { Nothing, Skipped, IsThing, } const identifyCall = (lhs: ts.Node, needles: ReadonlySet<string>): IdentifiedCall => { if (ts.isIdentifier(lhs)) { return needles.has(lhs.escapedText || lhs.text) ? IdentifiedCall.IsThing : IdentifiedCall.Nothing; } if (isPropertyCall(lhs) && lhs.name.text === 'skip') { return needles.has(lhs.expression.text) ? IdentifiedCall.Skipped : IdentifiedCall.Nothing; } if (ts.isParenthesizedExpression(lhs) && ts.isConditionalExpression(lhs.expression)) { return Math.max(identifyCall(lhs.expression.whenTrue, needles), identifyCall(lhs.expression.whenFalse, needles)); } return IdentifiedCall.Nothing; </ins> }; const isPropertyCall = ( <del> lhs: ts.LeftHandSideExpression </del> <ins> lhs: ts.Node </ins> ): lhs is ts.PropertyAccessExpression & { expression: ts.Identifier; name: ts.Identifier } => ts.isPropertyAccessExpression(lhs) && ts.isIdentifier(lhs.expression) && ts.isIdentifier(lhs.name); <del> const isSkipCall = (lhs: ts.LeftHandSideExpression) => isPropertyCall(lhs) && suiteNames.has(lhs.expression.text) && lhs.name.text === 'skip'; </del>