-
Notifications
You must be signed in to change notification settings - Fork 61
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
Something appears to mess with PATH on Travis Linux when running tests #20
Comments
This is a workaround for the PATH being messed up (see https://github.com/Microsoft/vscode-extension-vscode/issues/104).
As a workaround, since I only need to spawn nodejs, I'm just passing |
This is a workaround for the PATH being messed up (see https://github.com/Microsoft/vscode-extension-vscode/issues/104).
This is a workaround for the PATH being messed up (see https://github.com/Microsoft/vscode-extension-vscode/issues/104).
This is a workaround for the PATH being messed up (see https://github.com/Microsoft/vscode-extension-vscode/issues/104).
This is a workaround for the PATH being messed up (see https://github.com/Microsoft/vscode-extension-vscode/issues/104).
This is a workaround for the PATH being messed up (see https://github.com/Microsoft/vscode-extension-vscode/issues/104).
This is a workaround for the PATH being messed up (see https://github.com/Microsoft/vscode-extension-vscode/issues/104).
Please reopen if you still see this once https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_35.md#splitting-vscode-package-into-typesvscode-and-vscode-test lands. |
Will do! BTW, it seems like both those new packages exist - is there anything stopping me migrating now? (I'm not sure what needs to land). Thanks! |
@octref can maybe comment who is in charge of these new packages |
Go ahead and let me know issues you run into. |
@octref I noticed the info linked above has all been removed from the release notes: microsoft/vscode-docs@9402e03#diff-0ae46b9ea8531a6a66fe2ed2a836709a Does this mean it's not safe to go ahead with migrating? |
Scratch that, it seems to be working, so I've gone with it (though I'm curious why it was removed from release notes). @bpasero the original issue here is still present on latest versions of everything and using that package. It actually somewhat repros locally.. If I run
Inside the test, I have this:
And the output of the two differs. Inside the test the first three items have been added to the end of PATH and the first two of them removed from the beginning (in this case nothing is lost, but the ordering has changed which is still bad): Running on Travis Linux, some items are added to the beginning and end, and two items are removed from the middle (one of them is added to the beginning, so possibly removed to be de-duped, but the other is node - the same thing originally reported above): |
Here's the Travis log: https://travis-ci.org/DanTup/vscode_extension_path_test/jobs/541626326 |
PR welcome, I will not have time to look into this. |
@octref please decide if this should move into the |
I'm not sure I'd know where to start looking - I can't come up with any explanation for what might be happening 🤷♂️ It's not critical, I've worked around it by just setting another env variable and then reading from it in the extension, but it's a little weird 🙃 |
Ok good to know there is a workaround. We can close this issue if no-one jumps on it in the next weeks. |
https://github.com/microsoft/vscode-test/blob/master/lib/runTest.ts#L159-L160 I'm not sure if it's a Travis problem (maybe try Azure Devops?) or npm script limiting the |
Ok, this is easily reproducible on macOS locally, so it's not Linux specific or Travis specific. If I mess with my path (eg., push cwd onto the front
But if I run the way the test runner does (though I've removed the extension/test path since that makes no differences to the outcome):
The path is messed up:
Note that the entry I added is now near the end. |
I think I'm getting bitten by this one and would love some advice if possible! I'm trying to test an extension which spins up a language server via the During testing the extension fails to start the language server and reports an await runTests({
extensionDevelopmentPath,
extensionTestsPath,
extensionTestsEnv: process.env,
launchArgs: [extensionWorkspacePath, "--disable-extensions"]
}); I'm trying to run the tests on macOS 10.14 locally, and 10.13 on Travis. |
I never really got to the bottom of it. I think it may be node/npm messing with the path. My workaround was to use the full path to node when spawning my debug adapter (see Dart-Code/Dart-Code@e4b6fb0) instead of just "node" so it doesn't look in |
Ahh I see, thanks for the quick response! I might be able to make that work for testing, but since the language server executable is installed separately by the user, we'd have no control over the actual location of the binary so would need to rely on PATH resolution. I've opened up a new ticket #52 if you're interested in following along! Meanwhile I might do some more digging to see whether node or NPM are the culprits. |
Ah, my fix above only really fixed the ordering (where there were two different node versions). I did for a while (though I can't remmeber if it was because of this) put my paths into custom env variables, and then updated my extension to scan those locations before |
Oh ok. I think the problem I'm having is that none of the environment variables are being passed through to the test scripts. Even if I explicitly set some random variables, |
Having the same problem. Before calling |
I managed to get it working! My findings are here - #52 (comment) |
Thank you @disposedtrolley, Yes I just noticed you comment and had a try but still not able to workaround it. Not sure why. Maybe I'm using |
They are passed to
I pushed a branch: |
I pushed a repo to Travis that is just the TypeScript extension sample with a travis file that echos the
PATH
in the Travis script, thenpm test
script and then also inside the sample test. The values are different. Significantly, the path tonode
has been removed by the time we get into the tests. In my real project, this means my tests are failing because they use the DebugClient and passnode
as the executable.Here's the code:
https://github.com/DanTup/vscode_extension_path_test
Here's the Travis log:
https://travis-ci.org/DanTup/vscode_extension_path_test/jobs/362281254
Here's the relevant parts:
PATH
as output in the travis file:PATH
as output by prefixing thetest
script inpackage.json
withecho $PATH
:PATH
as output in tests:Note that
/home/travis/.nvm/versions/node/v8.11.1/bin
exists in the first and second, but not the last one (the one from inside the tests).The text was updated successfully, but these errors were encountered: