Giter Site home page Giter Site logo

Comments (4)

sagimann avatar sagimann commented on August 30, 2024

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.

sagimann avatar sagimann commented on August 30, 2024

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.

kenkinky avatar kenkinky commented on August 30, 2024

I got this BUG!

from mocha-sidebar.

brittaniSavery avatar brittaniSavery commented on August 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.