proposal: introduce "jest.runMode" to consolidate and simplify settings #1058
Replies: 3 comments 5 replies
-
As someone who is also struggling with a very large codebase (and I’m looking forward to being able to use your extension daily), I wonder if trying to give a name to a group of behaviours is problematic to begin with and might confuse people even more. So my recommendation is to instead have a capability based setting that allows devs with special requirements to turn off/tweak the “default”, which is not much different from the current status: type config = {
enabled: boolean,
testDiscovery: boolean,
autoRun: boolean | on-save
} |
Beta Was this translation helpful? Give feedback.
-
@drew-walker, @albertogasparin and whoever interested in this, here is a prototype: vscode-jest-6.0.2.vsix.zip, feel free to give it a try when you get a chance and let me know if it addresses your use case. |
Beta Was this translation helpful? Give feedback.
-
PR #1078 merged. Close the discussion. |
Beta Was this translation helpful? Give feedback.
-
Why
"jest.autoRun": "off"
the extension should be disabled, so users are often surprised and confused when the errors reveal the output terminals.autoRevealOutput
setting default is on-run, while make sense for projects that already setup to run, it might not be the right default for projects who are not ready to run (they will see it pop-up due to env related error for example). It seems we might need different defaults for different types of use-case?"jest.enable"
(adding jest.enable setting and adjust workspace operations accordingly #1009) to disable the extension, but then discovered there might be another in-between state also desirable (see Performance problems on large, multi-package monorepos #1030).What
This discussion addresses these issues by consolidating related settings into one
"jest.runMode"
, indicating the type of runtime preference so we could coherently tailor the related settings with appropriate defaults instead of discovering and adjusting them separately.The new setting
jest.runMode
will supersedejest.autoRun
,jest.autoRevealOutput
, andjest.showCoverageOnLoad
settings, which will be marked deprecated and be phased out in future releases.RunMode Type
There are 3 types of run modes (similar to autoRun), with some common options:
Pre-Defined RunMode ShortCut
There will be some pre-defined run-modes for convenience that most users would probably use, while internally, they will be mapped to the actual RunMode, allowing savvy users to customize further.
jest.enable
for it.Example
with predefined run mode:
"jest.runMode": "deferred"
,"jest.runMode": "on-demand"
.with actual run mode:
or
Runtime support
We will support runMode switch at run time, similar to the current autoRun/coverage toggling in TestExplorer. We could add a new feature to allow users to update the permanent setting based on the current runtime config, which can also be used for migration purposes.
Implementation Notes
The following are used for implementation discussion. If we set the run mode correctly, hopefully, we don't need to explain any of these to the end-users...
RunMode Features and Operations
The main feature and operation of each mode correspond to:
1: In this stage, the extension will examine if the environment is ready by finding and validating the settings, jest commands, workspace folders, etc. The TestExplorer will only show qualified workspace items, no test block items yet.
2: In this stage, the extension will invoke the jest command to find test files and parse the test files in order to show test block in the TestExplorer tree view as well as the editor gutter menu.
Beta Was this translation helpful? Give feedback.
All reactions