I'm working on a VS Code extension that leverages the Text Explorer view. Tests are added to the list, and a standard set of inline menu commands exist for each test. I'm trying to change this so that the menu commands displayed are appropriate for each particular test.
Things are defined like this (in package.json):
{
"contributes": {
"commands": [
{
"command": "runTest",
"title": "Run Test",
"icon": {
"light": "images/light/play-circle.svg",
"dark": "images/dark/play-circle.svg"
}
}
],
"menus": {
"testing/item/context": [
{
"command": "runTest",
"group": "inline",
"when": "resourceExtname == .json"
}
]
}
}
}
The inline group causes the command's icon to appear in a little toolbar in-line with the test, like this: 
With this contribution definition, I would expect that the "Run Test" command icon would only appear for those test items with a URI ending in .json, but it isn't working. In fact, none of the context keys documented here seem to work correctly, and I'm starting to wonder if they aren't supported in the Test Explorer view.
Maybe my understanding of how the 'when' clause works is wrong; I thought that each TestItem added to a TestController would sort of be filtered through the 'when' clauses when VS Code rendered the Test Explorer view. In other words, the various resource context keys would each be set to values pertaining to each TestItem (like resourceFilename would be set to jsb-004.json in my example) and then that could be used for comparisons in the 'when' clauses.
I'm running into similar problems with context menus, where right clicking on a test brings up a menu that doesn't seem to obey the 'when' clause definitions.
How can these Test Explorer menu commands be customized for each TestItem in the list?