-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi-pass environment variable resolution #2322
Add multi-pass environment variable resolution #2322
Conversation
We were passing the root of the test folder instead of the unitTests specific folder into the runner, so it wasn't finding unit tests.
If a variable had env, config, or workspaceFolder as substring, it was being treated as an environment variable lookup on the reminder of the string minus the character immediately following the substring. For instance: envRoot was being looked up as "oot" in the configuarion environment block. The issue is that the regex to match the env., config., and workspaceFolder. patterns used . instead of \.
This gets rid of linting errors and adopts a more BDD literate assert style.
@@ -24,7 +24,7 @@ | |||
"runtimeExecutable": "${execPath}", | |||
"args": [ | |||
"--extensionDevelopmentPath=${workspaceFolder}", | |||
"--extensionTestsPath=${workspaceFolder}/out/test" | |||
"--extensionTestsPath=${workspaceFolder}/out/test/unitTests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's interesting...I guess we don't Launch Tests very much :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. I'm not done reviewing yet...
@bobbrow Raised a good point in that this a lot of added complexity for nesting variable, and the case that this is a useful feature for customers is a nebulous prospect at best. With that in might, I pushed a change which simplifies this feature at the expense of nested variables. |
newValue = process.env[name]; | ||
} | ||
break; | ||
let regexp: () => RegExp = () => /\$\{((env|config|workspaceFolder)(\.|:))?(.*?)\}/g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me. Bob will probably want to finish reviewing as well.
Do you know what's up with the Travis CI failure? |
As per microsoft/vscode-wordcount#5, running tests from CLI isn't supported with vscode except through the [workaround listed for Travis CI](https://code.visualstudio.com/docs/extensions/testing-extensions#_running-tests-automatically-on-travis-ci-build-machines).
These tests should pass in the future. I added the fix for Travis CI. |
Realized I had left out the CHANGELOG update. For [PR 2322](microsoft#2322).
Realized I had left out the CHANGELOG update. For [PR 2322](microsoft#2322).
Realized I had left out the CHANGELOG update. For [PR 2322](microsoft#2322).
Realized I had left out the CHANGELOG update. For [PR 2322](#2322).
Per issue #2057.
This allows a user to nest environment tags, or define tags based on the definition of other environment variables. If the result of a resolution still contains a
${...}
tag, we will continue to scan the input until we reach a steady state where the variable expansion results in the same input.This should allow the following forms which were previously not possible in the environment definition: