-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
jest-editor-support: Add support for Windows Subsystem for Linux in Runner #6941
Conversation
62135b3
to
e46ab29
Compare
Codecov Report
@@ Coverage Diff @@
## master #6941 +/- ##
==========================================
+ Coverage 67.25% 67.28% +0.03%
==========================================
Files 248 249 +1
Lines 9641 9614 -27
Branches 3 3
==========================================
- Hits 6484 6469 -15
+ Misses 3156 3144 -12
Partials 1 1
Continue to review full report at Codecov.
|
@orta @seanpoulter @connectdotz mind reviewing this? |
I'll have some time towards the end of the week to really get into it if the other two don't. Looks great at a glance though. Nicely done Jannis! |
@orta @seanpoulter @connectdotz ping 🙂 |
I don't have a window machine to verify this, if @seanpoulter didn't have time to review it, I suggest @stephtr who actually reviewed the original jest-community/vscode-jest#331 |
|
||
// If a path to configuration file was defined, push it to runtimeArgs | ||
if (workspace.pathToConfig) { | ||
runtimeArgs.push('--config'); | ||
runtimeArgs.push(workspace.pathToConfig); | ||
} | ||
|
||
if (workspace.useWsl) { | ||
runtimeArgs = [command, ...runtimeArgs.map(convertWslPath)]; |
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.
Just for consistency I would also convert command
such that we also support absolute commands.
At first thank you for your work! |
Hey,
as possible config options?
|
In my opinion that would be perfect!
You initially added the |
You're right, I somehow had in mind vscode-jest reads the file by itself. Thanks! Then I'll
I hope that I manage to do it in the next few days |
Sounds good to me. |
I'm unable to comment for a few weeks, sorry. |
@stephtr : Sorry for the delay here (I didn't find too much time for reworking it, and my main system is Fedora again). One question regarding file naming: I will add a result_reader module which contains a readTestResults. Now I'm a bit confused because some modules are uppercase (Process.js) and others are lower / snakecase (test_reconciler). Is there some kind of pattern behind this? Should I use result_reader.js or ResultReader.js? |
See #4969 |
e46ab29
to
8e188b6
Compare
…unner * Add useWsl configuration flag to project worksapce * Translate windows paths in call args to POSIX paths valid in WSL see jest-community/vscode-jest#331
2361f16
to
83573c0
Compare
…upport, support multiple wsl environments - The useWsl config in ProjectWorkspace can now be either 'true' or the actual wsl command (e.g. 'ubuntu run') - Resolving the path is done after resolving the json file, so for projects using jest-editor-support no extra effort is required to support useWsl
83573c0
to
cd11442
Compare
@stephtr I updated the PR as discussed, maybe you find some time to look over it |
/** |
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.
what's up? lf vs crlf?
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.
Strange - in my local dev environment it's LF (and I disabled autoCLRF), I'll verify that
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.
In the master this file is CLRF while all other files are LF - is that intended?
file index.d.ts
index.d.ts: ASCII text, with CRLF line terminators
if so, I switch back to CLRF for this file only
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.
I'm quite sure that this wasn't intended, but it's probably better to change line endings in a separate PR.
@@ -40,7 +42,7 @@ export default class Runner extends EventEmitter { | |||
this._createProcess = (options && options.createProcess) || createProcess; | |||
this.options = options || {}; | |||
this.workspace = workspace; | |||
this.outputPath = tmpdir() + '/jest_runner.json'; | |||
this.outputPath = tmpdir() + sep + 'jest_runner.json'; |
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.
path.join
instead
b4d2799
to
9f62a27
Compare
@mojadev could you open this up against https://github.com/jest-community/jest-editor-support (See #7232). Thanks, and sorry for the inconvenience! |
No problem! Actually the big jest setup causes real issues for me under WSL (mostly yarn and npm related), so I appreciate having a dedicated repo.
From: Simen Bekkhus
Sent: Monday, October 22, 2018 1:30 PM
To: facebook/jest
Cc: Jannis Moßhammer; Mention
Subject: Re: [facebook/jest] jest-editor-support: Add support for WindowsSubsystem for Linux in Runner (#6941)
@mojadev could you open this up against https://github.com/jest-community/jest-editor-support (See #7232).
Thanks, and sorry for the inconvenience!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
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.
Sorry for the delay.
In principle it looks good to me, once we have the PR in the new repository, we will test it and hopefully ship it soon.
/** |
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.
I'm quite sure that this wasn't intended, but it's probably better to change line endings in a separate PR.
* | ||
* @param coverageMap The coverage map to rewrite | ||
*/ | ||
const translateWslPathCoverateToWindowsPaths = ( |
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.
"Coverate" is probably a spelling mistake?
if (workspace.useWsl) { | ||
// useWsl can be either true for the default ('wsl' or the explicit | ||
// wsl call to use, e.g. 'ubuntu run') | ||
const wslCommand = workspace.useWsl === true ? 'wsl' : workspace.useWsl; |
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.
In order to not duplicate your code, I would use your getWslCommand
function from readTestResults.js (even though I would then place the function in another file, maybe we need a helper.js file or similar).
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
see jest-community/vscode-jest#331
Summary
See jest-community/vscode-jest#331 for motivation.
When running vscode in Windows but executing jest in WSL (WIndows Subsystem for Linux), additional steps have to be performed:
Test plan
See the following command being executed on a Windows 10 Host - normally the path would be C:..