AnWeber / vscode-httpyac

Quickly and easily send REST, Soap, GraphQL, GRPC, MQTT and WebSocket requests directly within Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=anweber.vscode-httpyac
MIT License
222 stars 20 forks source link

Trigger reset environment (before a test suite) #225

Closed sir-farfan closed 9 months ago

sir-farfan commented 9 months ago

Hello Because reasons, I need to remove all cookies and variables before running a whole file.

"httpYac: Reset Environments" is at the top when I press F1.

I only need to reset when running all the tests in a file, not when I'm sending individual requests one by one.

Sometimes I forget to do it and half of the tests fails xD Is there a configuration or directive I can put somewhere to make that happen automatically?

AnWeber commented 9 months ago

@sir-farfan It is easily possible via script in the file to reset the environments, but this would always be for all executions. This is probably rather undesirable. I would suggest that I include these changes.

Does that sound good? It will take a few days though, as I just started a little side project.

sir-farfan commented 9 months ago

Hi @AnWeber yeah, that sounds good. I appreciate the intention, the plugin has been a big help so far :)

AnWeber commented 9 months ago

The feature will be delivered with the next version. I will release this in the next few days, probably on Sunday.

alekdavisintel commented 2 weeks ago

Where do you set testRunResetEnvBeforeRun? I added it to the .httpyac.config.js file but it made no difference.

module.exports = {
  "log": {
    "level": "debug",
    "supportAnsiColors": true,
  },
  "cookieJarEnabled": true,
  "envDirName": 'env',
  "proxyExcludeList": [
    "localhost"
  ],
  "request": {
    "https":  {
      "rejectUnauthorized": false
     }
  },
  "testRunResetEnvBeforeRun": true
}

I assume that every time I run tests from the Testing menu, it would execute httpYac: Reset Environments, but it doesn't seem to do so, at least, I do not see it generating a new token every time I run a file or folder.