Balrog994 / cucumber-test-runner

An Extension for Visual Studio Code to Run and Debug CucumberJS Tests
MIT License
4 stars 6 forks source link

Being able to change the config file to be used when running a test via Test Explorer #6

Closed hardymj closed 1 year ago

hardymj commented 1 year ago

In Jasmine. You can specify the configuration to use by updating the setting.json file within the code base.

In this example

"jasmineExplorer.env": { "NODE_ENV":"int" } It will go looking for the int.json file in the config folder. If no file is found it looks for the default.json config.

If you launch a cucumber test via using a launch.json file you can specify a config / environmental variables within there.

"configurations": [
{ "env": { "NODE_ENV":"int" } }

Is there a way of when running a test via Test Explorer, Run Test for Cucumber to pick up a launch.json config OR to utilise a setting.json file and use the environmental variables?

Balrog994 commented 1 year ago

Unfortunately not right now, I'm actually planning to add some configuration options to the extension. Given your request I may also add a configuration to specify environment variables.

In the meantime I think you could work around this limitation by using a JavaScript configuration file for cucumber and loading an .env file using the dotenv library.

I guess it should work, not exactly what you asked for, but it may allow you to run your tests from the Test Explorer.

hardymj commented 1 year ago

New to Typescript and creating VSIX but I've had a go at a pull request. https://github.com/Balrog994/cucumber-test-runner/pull/7