mocha-sidebar
mocha-sidebar copied to clipboard
Command 'mocha-maty.refreshExplorer' not found (again)
Description
'command 'mocha-maty.refreshExplorer' not found' pops up when trying to refresh the test sidebar I've read previous issues on the error message, which was supposed to be fixed in v0.20.x, however, I'm using a newer version
Thanks!
Steps to Reproduce
- create a project with src/ and test/ sibling folders
- under src, run npm init, npm install
- Go to the test sidebar, wait for the test progress bar to stop
- Click 'refersh' icon
Expected Results
No error is shown and the tests appear
Actual Results
The refresh process should show the tests instead of the error message
Settings file
none
Versions
- VScode: v1.41.1
- Mocha SideBar: v0.22.2
- Node Version: v10.16.0
OS version
- [ ] Linux
- [ x ] Mac 10.15
- [ ] Windows
Update: it seems that this settings.json works around the issue:
{
"mocha.files.glob": "test/**/*.js",
"mocha.nycPath": "/Users/xxx/test/mocha1/src/node_modules/nyc",
"mocha.env": {
"NODE_PATH": "/Users/xxx/test/mocha1/src/node_modules"
}
}
After I put this file under
I'm not familiar with VSCode extension development, but after checking your lib/config.js and sending a few debug messages to VSCode, it seems that mocha.xxx settings in settings.json do not support VSCode env variables. I was easily able to add such support for specific variables by changing lib/config.js as follows:
const substituteVSCodeVars = (value) => {
return value.replace('${workspaceFolder}', vscode.workspace.rootPath);
}
if (nycPath) {
return substituteVSCodeVars(nycPath);
}
...
let tmpEnv = [];
try {
tmpEnv = JSON.parse(JSON.stringify(getConfiguration().env));
for (let k in tmpEnv) tmpEnv[k] = substituteVSCodeVars(tmpEnv[k]);
} catch (error) {
messages.sendPopUpMessage(error.stack);
}
const env = () => tmpEnv;
I got this BUG!
I am also experiencing this bug though I cannot execute any of the mocha sidebar commands. I have tried to uninstall and reinstall the extension and my VSCode instance as well as use full paths. No luck on my end. I didn't have any special options added on.