Comments (4)
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 /.vscode/settings.json, the Mocha Sidebar can detect the tests. But this is not a completely viable workaround because it only seems to work with fully qualified paths for nycPath and NODE_PATH. If I either try to use a relative path or ${workspaceFolder}, it breaks as before:
src/xxxx
${workspaceFolder}/src/xxxxx
from mocha-sidebar.
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;
from mocha-sidebar.
I got this BUG!
from mocha-sidebar.
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.
from mocha-sidebar.
Related Issues (20)
- v0.22.2 isn't tagged (?)
- ge report html nyc mocha
- Failed test error message persisting through successful test run
- Extension issue
- It doesn't run my setup/global file as mocha does HOT 3
- Test failure results not displayed anywhere
- Unit tests (usually) do not attach to debugger unless the focus is on the file that is being tested - Inconsistent
- Feature request: configure different run command for tests in a given directory by placing a config file in the directory
- Crashes
- Debug/run a single TypeScript test from Sidebar fails HOT 1
- cannot run es6 modules based tests HOT 3
- Mocha sidebar extension issue in VSCode HOT 1
- Does this repo have any maintenance at all?
- cant find nyc locally HOT 2
- Click for coverage fails with 'ReferenceError: suite is not defined'
- cannot find module when importing json file in nodejs application
- Is this project abandoned? Alternatives? HOT 2
- support for c8 coverage tool
- [Typescript] "Run test at cursor" command fails with "Mocha is only available for JavaScript files."
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mocha-sidebar.