improve default command creation and messaging #953
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current default command is quite "shallow", which only looks for candidates in the current project root. And when it did not find it, it should have failed immediately but did not, which led to the process failure later.
deep search
In this PR, we will expand the existing logic by searching deeply from the workspace to find all possible subfolders (folders with package.json) and look for binary/test-script within. Basically, perform a deep auto-config for
jest.rootPath
andjest.jestCommandLine
.Note, auto-config is a best-effort, it might still require manual setup sometimes, such as:
There might be more, but now when the auto-config fails, users will see a clear message showing why jest command is not found, and has an opportunity to fix them (via the "Fix" button in the error panel), hopefully, easily.
favor test script over direct binary execution
This is a breaking change, if user has a jest
test
script in theirpackage.json
, we will use the script (either npm or yarn) instead of jest binary in node_modules.overhead
This new feature does take a little bit more time at start-up time, but only for users who don't have a shallow jest command.
Notes for Future PRs