-
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
Running tests from whole folder does not work, wrong testPathPattern option #1079
Comments
I believe the vscode-jest/src/JestProcessManagement/JestProcess.ts Lines 139 to 141 in 10414ab
And the value for vscode-jest/src/test-provider/test-item-data.ts Lines 501 to 505 in ad719cb
And vscode-jest/src/test-provider/test-item-data.ts Lines 479 to 483 in ad719cb
When you look at the vscode-jest/src/virtual-workspace-folder.ts Lines 93 to 117 in ad719cb
The comment above it sounds like it's something we need. But the Is it possible that the fix would look like this? get uri(): vscode.Uri {
return this.effectiveUri;
} |
Ok, I think it's something like this: The URI of the virtual workspace folder is defined to be the same as the "actual workspace folder". There's even a unit test for this vscode-jest/tests/virtual-workspace-folder.test.ts Lines 35 to 37 in ad719cb
So whenever we run the command for my To establish the test path patterns, we need to craft the URIs with the help of But, then there's a question of "what is the root parent element"? And I think the answer is in line 194: vscode-jest/src/test-provider/test-item-data.ts Lines 193 to 194 in ad719cb
If there are no parents, then the root is the It would then explain why
and the We would need to somehow add the information about the effectiveUri to the |
I think the only way to make it work is for the
This makes sense, cause the "virtualness" of the folder is transparent to the context class, so it should behave as a real folder and return its real URI. I'll try to prepare a PR tonight |
@akwodkiewicz, good catch and nice investigation. 👍 But let's not change the
I hope this is enough to fix the issue and look forward to the PR! |
@connectdotz, thanks for the suggestions.
Do you mean the setup wizard? (maybe it's broken too 😅) I followed your advice and prepared a PR according to your proposal: #1080 I launched the modified extension on my repo and it worked correctly! |
Sorry but it doesn't work without any virtual folders(
where |
Environment
vscode-jest version
: v6.0.1node -v
: v18.16.0ornpm -v
yarn --version
: 3.4.1:npm ls jest
ornpm ls react-scripts
(if you haven’t ejected)yarn why jest
my.code-workspace
:Prerequisite
npm run test
ornode_modules/.bin/jest
)yarn test
Steps to Reproduce
Open "Testing" tab
Try to "Run Test" on a "folder" item (for the purpose of troubleshooting, I'm selecting the
redis
folder in my project).Relevant Debug Info
I'm running VSCode from a .code-workspace file, this is a monorepo, but I don't have multiple roots defined (and I don't want to have them). I'm trying this new
virtualFolder
setup.Might be unrelated to the issue, though.(EDIT: it probably is the issue, see the next comment)Full path to the redis folder:
/Users/akwodkiewicz/Private/repo-A/packages/backend/src/redis
Relative path to the .code-workspace file
packages/backend/src/redis
Expected Behavior
All tests from the selected folder are run.
Actual Behavior
No tests are found.
"Test Results" tab output (added line breaks in command for readability):
It looks like the--testPathPattern
should be set toredis
-- then searching for this path pattern would be successfulIn /Users/akwodkiewicz/Private/repo-A/packages/backend/src
.However, the script is passed a faulty concatenation of the workspace absolute path (/Users/akwodkiewicz/Private/repo-A
), the outersrc
folder (which is visible in the "Testing tab", but I did not put it on the screenshot), andredis
.EDIT: The
--testPathPattern
is wrong, but a better analysis of what happens is in the next commentThe text was updated successfully, but these errors were encountered: