{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib/issues/471","repository_url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib","labels_url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib/issues/471/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib/issues/471/comments","events_url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib/issues/471/events","html_url":"https://github.com/Microsoft/azure-pipelines-task-lib/issues/471","id":379245306,"node_id":"MDU6SXNzdWUzNzkyNDUzMDY=","number":471,"title":"Values provied to setInput() appear to be shared across tests","user":{"login":"charleszipp","id":4292559,"node_id":"MDQ6VXNlcjQyOTI1NTk=","avatar_url":"https://avatars3.githubusercontent.com/u/4292559?v=4","gravatar_id":"","url":"https://api.github.com/users/charleszipp","html_url":"https://github.com/charleszipp","followers_url":"https://api.github.com/users/charleszipp/followers","following_url":"https://api.github.com/users/charleszipp/following{/other_user}","gists_url":"https://api.github.com/users/charleszipp/gists{/gist_id}","starred_url":"https://api.github.com/users/charleszipp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charleszipp/subscriptions","organizations_url":"https://api.github.com/users/charleszipp/orgs","repos_url":"https://api.github.com/users/charleszipp/repos","events_url":"https://api.github.com/users/charleszipp/events{/privacy}","received_events_url":"https://api.github.com/users/charleszipp/received_events","type":"User","site_admin":false},"labels":[{"id":233106702,"node_id":"MDU6TGFiZWwyMzMxMDY3MDI=","url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"damccorm","id":42773683,"node_id":"MDQ6VXNlcjQyNzczNjgz","avatar_url":"https://avatars2.githubusercontent.com/u/42773683?v=4","gravatar_id":"","url":"https://api.github.com/users/damccorm","html_url":"https://github.com/damccorm","followers_url":"https://api.github.com/users/damccorm/followers","following_url":"https://api.github.com/users/damccorm/following{/other_user}","gists_url":"https://api.github.com/users/damccorm/gists{/gist_id}","starred_url":"https://api.github.com/users/damccorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damccorm/subscriptions","organizations_url":"https://api.github.com/users/damccorm/orgs","repos_url":"https://api.github.com/users/damccorm/repos","events_url":"https://api.github.com/users/damccorm/events{/privacy}","received_events_url":"https://api.github.com/users/damccorm/received_events","type":"User","site_admin":false},"assignees":[{"login":"damccorm","id":42773683,"node_id":"MDQ6VXNlcjQyNzczNjgz","avatar_url":"https://avatars2.githubusercontent.com/u/42773683?v=4","gravatar_id":"","url":"https://api.github.com/users/damccorm","html_url":"https://github.com/damccorm","followers_url":"https://api.github.com/users/damccorm/followers","following_url":"https://api.github.com/users/damccorm/following{/other_user}","gists_url":"https://api.github.com/users/damccorm/gists{/gist_id}","starred_url":"https://api.github.com/users/damccorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damccorm/subscriptions","organizations_url":"https://api.github.com/users/damccorm/orgs","repos_url":"https://api.github.com/users/damccorm/repos","events_url":"https://api.github.com/users/damccorm/events{/privacy}","received_events_url":"https://api.github.com/users/damccorm/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-11-09T17:05:50Z","updated_at":"2018-11-12T13:48:48Z","closed_at":null,"author_association":"MEMBER","body":"I am noticing that inputs set from the tests appear to carry over from test to test. For example lets say I have an `setInput(\"backendType\", \"foo\")` in my first test. Then in the second test I am asserting what happens if `backendType` input is not set (its an optional input). When the second test executes the stdout shows that the value of `backendType` is still `foo`. \r\n\r\nThis looks to be due to the fact that setInput simply sets a process environment variable. The environment variables seem to carry over from test to test. \r\n\r\nI was able to work around this issue by adding this code to the start of each scenario I am testing\r\n```javascript\r\n//clear any environment vars set by the previous run\r\nObject.keys(process.env)\r\n    .filter(key => key.startsWith(\"INPUT_\"))\r\n    .forEach(key => delete process.env[key]);\r\n```\r\n\r\nI was expecting each run to execute in an isolated/clean environment. If this is by design feel free to close this. However, I wanted this documented in case someone else runs across the same issue."},"comment":{"url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib/issues/comments/437887044","html_url":"https://github.com/Microsoft/azure-pipelines-task-lib/issues/471#issuecomment-437887044","issue_url":"https://api.github.com/repos/Microsoft/azure-pipelines-task-lib/issues/471","id":437887044,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzg4NzA0NA==","user":{"login":"damccorm","id":42773683,"node_id":"MDQ6VXNlcjQyNzczNjgz","avatar_url":"https://avatars2.githubusercontent.com/u/42773683?v=4","gravatar_id":"","url":"https://api.github.com/users/damccorm","html_url":"https://github.com/damccorm","followers_url":"https://api.github.com/users/damccorm/followers","following_url":"https://api.github.com/users/damccorm/following{/other_user}","gists_url":"https://api.github.com/users/damccorm/gists{/gist_id}","starred_url":"https://api.github.com/users/damccorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damccorm/subscriptions","organizations_url":"https://api.github.com/users/damccorm/orgs","repos_url":"https://api.github.com/users/damccorm/repos","events_url":"https://api.github.com/users/damccorm/events{/privacy}","received_events_url":"https://api.github.com/users/damccorm/received_events","type":"User","site_admin":false},"created_at":"2018-11-12T13:48:48Z","updated_at":"2018-11-12T13:48:48Z","author_association":"CONTRIBUTOR","body":"I think in theory I like this, but having both this option and the setInput option feels confusing to me - I don't really like the idea of having both and duplicating functionality in a way that works slightly differently. Really the only difference between using setInput and passing in an object would be that setInput values persist across test runs, and that feels a little too subtle for me to be comfortable with. I think I'd probably rather wait until we release the major version (again, this shouldn't be too far away)"}}
{"actor":{"display_login":"damccorm"}}