hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
91 stars 31 forks source link

mochaExplorer.env doesn't work in .mocharc.* files #175

Closed clintonb closed 3 years ago

clintonb commented 3 years ago

My project uses .mocharc.js to configure Mocha. Adding mochaExplorer configuration does nothing. I am specifically trying to set environment variables. I was only able to set them by using .vscode/settings.json. Is this expected behavior? If so, please update the README to clarify usage of .mocharc.* files and how these settings should be configured.

Here is my .mocharc.js file:

module.exports = {
  exit: true,
  recursive: true,
  reporter: 'mocha-multi-reporters',
  reporterOptions: {
    reporterEnabled: 'spec, mocha-junit-reporter',
  },
  // TODO Configure test output once issue resolved:
  //    https://github.com/stanleyhlng/mocha-multi-reporters/issues/60
  // mochaJunitReporterReporterOptions: {
  //   mochaFile: './test-reports/junit.xml'
  // },
  timeout: 5000,
  mochaExplorer: {
    env: {
      NODE_ENV: 'test',
    },
  },
};
hbenl commented 3 years ago

All the mochaExplorer.* settings need to go into your VSCode settings (.vscode/settings.json).

clintonb commented 3 years ago

@hbenl can you update the README to explicitly state this, please?

hbenl commented 3 years ago

@clintonb Yes, I'll do that. Sorry for the confusion.