Open mooreniemi opened 1 year ago
What OS and which terminal are you using?
AmazonLinux2 and zshell.
% uname -a
Linux ... 5.4.209-129.367.amzn2int.x86_64 #1 SMP Wed Aug 31 17:08:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
% zsh --version
zsh 5.8.1 (x86_64-koji-linux-gnu)
(I see no difference switching to bash
.)
Hmm ok. Can you confirm what version of jest
you're testing against?
I've ran into the same issue and it seems to be caused by symlinks. My code is in /dev/project/
where /dev/
is also symlinked to ~/dev/
. If I open VS Code from ~/dev/project/
, the plugin generated an absolute path based on ~/dev/project/
whereas Jest picks up the absolute path from /dev/project/
and so the regex doesn't match. Opening VS Code from /dev/project/
solves the issue.
Yeah, I also have a similiar problem on Windows, using the subst
command to "symlink" a directory to a drive letter. E.g. I have the directory C:\Data
linked do the drive D:\
. Executing a test (with plain jest
) using jest D:/file/to/test
, doesn't work, whereas jest C:/Data/file/to/test
does. So it seems it's not directly a problem with the extension, but more with jest (or node).
So my workaround is to import the project from the C:/Data
directory into VSCode instead of the one from D:/
. This works with using the extension. I don't know if it's possible to resolve the symlinks in a VSCode extension, so it would pass this file name to the jest command instead. Using a relative path would be nice, too.
For context, I'm running jest 27.5.1 and node 16.16.0
Based on what I see in your demo output (below image), you are sending a command with an absolute path like below:
But though I see this in my vs code terminal such a valid path is being used, it doesn't work for me (nor does just running the command itself), and I don't understand how it could based on
jest
documentation since this argument is meant to be a regex.If I do a relative path (below), I see
jest
work for me, butRun
button doesn't (and probably can't?) send a relative path:Does this extension (and those like it, that send absolute paths) only work for certain older versions of
jest
? Might there be some other problem with my setup that could cause this issue?I'm on: