-
Notifications
You must be signed in to change notification settings - Fork 293
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
introduce interactive mode and new process model #674
introduce interactive mode and new process model #674
Conversation
Pull Request Test Coverage Report for Build 903
💛 - Coveralls |
I know this is a HUGE PR, sorry about that, trying to take advantage of the alpha status for this scale of changes. It is probably not feasible for one person to review everything, so I tagged a few reviewers. Please feel free to do a partial review for the part that you are most familiar with or interested in. In addition to code, I also made a pretty significant change to the README, would appreciate some editorial review and feedback. @marcinczenko I think you are pretty familiar with the process-management, do you mind taking a look in that area? @stephtr would you mind looking at the JestExt and extension management? @orta and @seanpoulter feel free to jump in if you have some bandwidth... |
@@ -39,10 +52,6 @@ A comprehensive experience when using [Facebook's Jest](https://github.com/faceb | |||
|
|||
<img src="https://github.com/jest-community/vscode-jest/raw/master/images/vscode-jest.gif" alt="Screenshot of the tool" width="100%"> | |||
|
|||
## Maintainers | |||
|
|||
Orta Therox ([@orta](https://github.com/orta)), Vincent Voyer ([@vvo](https://github.com/vvo)) & ConnectDotz ([@connectdotz](https://github.com/connectdotz)). |
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.
IMO, you should switch this to you 👍🏻
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 just happened to have some freecycle recently so decided to take on these big-ticket items. Unfortunately, I didn't set a good example for the more "progressive" PR, but I think this kind of change is probably not a good fit for that. Nevertheless, I probably should have open a discussion thread before pulling the trigger... Please do feel free to voice your opinions, PR is not merged in, it's not too late.
Ok, now to the actual point, I think we need more maintainers, not less, so we can have more people bouncing ideas and widening perspectives. How do you decide the maintainers? Do you have any suggestions on who else we can add? I know @stephtr is busy recently, but he has been very helpful in our recent PRs, do you think we could add him as the maintainer?
IMO, you should switch this to you 👍🏻
You mentioned this couple of times, I might change my mind in the future, but right now I quite enjoy you being the owner so I have somebody to discuss and learn from 😄
@connectdotz I will take a look. Most probably tomorrow. |
@connectdotz I could not find much time last week. Started today. I had to refresh myself a bit over the overall structure as I forgot most of the stuff ;). This is what I will be doing next: I am looking at processes-related stuff to see if I spot something that I feel needs some attention - not really deep - more in the spirit "can I follow it and does it make sense". I will also run it on some projects to see if I hit any troubles. I will try to reserve like an hour a day in the next week or so. I may also have some suggestions for the In general the proposal looks good and it should improve the overall developer experience. In case I would be blocking anything please let me know. |
@marcinczenko sounds good! Do what you can, any extra test and eyeballs is a plus, appreciate it! 🙏 Aiming to start alpha testing next week if possible, let's see what we can get through before the end of the week... |
* use Map to store jest instances * remove enbledWorkspaceFolders, update README, handle disabledWorkspaceFolders change on the fly * review fixes * Fix typo
@marcinczenko did you get a chance to test or review this PR further? |
@orta I updated README to address your comment and tidy it up a bit. Looks like we are not going to get more testing or review by leaving the PR here... what do you think we should do? Should we merge it in and cut an alpha release so we can get a bigger community to try it? |
@connectdotz Yes, but it is going slow. I would explain myself better with a DM, but I do not know if my "whys" really matter. Shortly, I still need some time. Sorry about that... I like your comment about an alpha or a "canary" release so that we can win some time but already provide it for those who already want to give it a spin. |
The vscode marketplace doesn't really allow for separate versions of the same extension without having it as an entirely different app. You could se tup nightlies if you wanted, I did that for Svelte's vscode extension: https://github.com/sveltejs/language-tools/blob/master/.github/workflows/Deploy.yml I'd double check that you're fine with it then ship it, and expect bug reports. It's OSS and in your spare time. |
@orta, thanks for sharing the idea! 👍
True, I don't think it is ready for production yet, but keeping it here also does not get us closer to the finish line... Ideally, it would be better for people in this thread to test run it before open to the public. But it looks like everybody is super busy; therefore, I think a "private" alpha release might be an acceptable alternative to try moving forward. Let's do this: I will cut an alpha-5 release, including this PR and the wizard, but won't publish to the marketplace; announce it in the related issue threads to hopefully get more people testing it (it seems to work out ok with prior alpha releases). Meanwhile, @marcinczenko, thanks for trying to find time to review 👍 . I know how hard it is sometimes... Please continue and do not hesitate to ask any questions. After merging, this PR might be automatically closed, but you should still be able to review it. I will look out for your comments. |
@connectdotz Thanks for your understanding and patience. I will do my best. |
part of the v4 initiative...
This PR introduces a new "interactive" mode that allows users to control when and what tests should be run, in addition to the current "watch" mode where jest/watcher will run the related tests whenever relevant files changes. This is a common pain point for projects with many tests and or a single source file change can trigger many test re-run, which can all cause high CPU, especially during the development phase.
While working on this change, needed to refactor our process management model that we have wanted to do for a long time. Replaced the nested process model with a queue-based model, so no more keep-alive, callback, and assumption of the test sequence, etc.
Another significant change is to split the
JestExt
into multiple files and move to a new directory. This helps better componentization and better test coverage. Hopefully will make future change easier as well.The new process model added a few benefits that should make the extension smarter and liter not only for the interactive but the watch mode as well, such that we know what are test files without doing the full test run, and we can update snapshots without restarting the jest process.
The last but not least, I think this PR is moving us closer to support the vscode's test API proposal, which is an interactive test-item-driven provider framework. We still have some work to do and the API is not finalized yet, but it is clear that we do need to support an interactive mode anyway.
Change Outline
interactive mode
jest.autoRun
to let users control when the extension should run tests automatically. This supports:"jest.autoRun": {"watch": true, "onStartup": ["all-tests"]}
"jest.autoRun": {"watch": false, "onSave": "test-file"}
or"jest.autoRun": {"watch": false, "onSave": "any-file", "onStartup": ["all-tests"]}
{"jest.autoRun": "off"}
Jest: Run Related Tests
. This menu will only appear in interactive mode and for both test and source files.commands
new context menu
new keyboard shortcut
StatusBar
editor visual enhancement
Snapshot enhancement
refactor jest process management
JestExt
based on thejest.autoRun
.--updateSnapshot
flag.refactor jest run handling / JestExt
JestExt.ts
into multiple files and move to a new folder.Open Questions
ExtensionManager
when config changed. This could lead to memory leaks as the previously registered JestExt were not being "deactivated". I did not see why they have to be registered again, so removed that logic altogether. Please let me know if there is a legit reason otherwise.Testing
Added quite a bit of test along the way, which served as a live-testing for this PR. I did like the interactive mode with autoRun on test file save. Even though it starts a new process for every test file saves, at least on my mac, it still feels snappy compared to the watch mode. The big difference comes in when I change the source file like
JestExt.ts
, which means triggering 25 test files to be executed, not surprisingly a lot slower than just runJestExt.test.ts
with interactive mode. But would be interested to see if how it performs in other OS/machine/projects...Anyway, I am sure we need more testing and so probably earlier we can get people to start playing with it the better. I hope to cut a
jest-editor-support
release in the next couple of days so reviewers can run the actual extension during the review.ToDo
jest-editor-support
(fix snapshot, runner, test_reconciler jest-editor-support#63), will update once it is released.resolves #613
resolves #668
resolves #119
resolves #308
resolves #176
resolves #408
resolves #530
resolves #36
resolves #574