-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
How to use the custom matchers? #358
Comments
@JohanHeyvaert can you provide a reproduction of this, please? @bogusweb, did you checked that your latest change didn't cause regressions in our custom matchers? |
@NetanelBasal @JohanHeyvaert It's a little strange, because the library itself has a few tests that check this function and in the library the tests pass correctly. But in my project where I use the latest version I also get error such as @JohanHeyvaert. After a little analysis, I have no idea what could have happened here :/ I try analysis more this tomorrow |
@NetanelBasal its super weird, just write simple test in my project:
and passed, I will still try to reproduce this bug using hostFactory. |
okay, i have no idea why this not work for @JohanHeyvaert. |
You don't have a type error? |
Thank you for your efforts. I still don't know why its not working in my project. Thanks for the sample repository, that could be really helpful. |
Mmmm, searched but still don't understand. It doesn't seem to be caused by a version issue: tried to use in my project the same versions as the sample project: not working. Tried to use in the sample project the same versions as in my project: keeps working. The configuration was a bit different:
But using that same config doesn't fix the problem. That difference is probably caused because we started the project with an older version of Nx. I don't have time anymore to continue searching now. Will be continued. |
Ah yes, I don't really understand how typescript is supposed to know where to find these custom matchers?
|
Hi! I encountered the same issue, and for now I'm not sure what's causing this... Minimal reproduction: https://github.com/Wykks/spectator-jest-issue-358 (tested : Angular 10 & Angular 11 everything up to date) Interestingly, in my project vscode was not reporting any issue, just like you Johan. But in this minimal reproduction I actually see the error in vscode. |
I'm experiencing a similar issue. We have two projects, one using spectator 5.13.3, and one using spectator 6.1.0. In 5.13.3, all matchers work as expected. In 6.1.0, my IDE (WebStorm) is unable to find the custom matchers. Is there anything that needs to be configured? I looked at the documentation and couldn't find anything. |
@Wykks Hi, you have one error in the example that makes it not work. It is clearly stated in the documentation that when you want to use spectator with jest for testing you should improve your imports, here https://github.com/ngneat/spectator#jest-support. After update import from |
@AndreasHae check import, if u use jest u need import from |
Oh wow this is embarrassing. I was so sure about importing It's because I didn't set (And for some reason, when vscode is "used to" |
"Embarrassing" is the good word. Same problem & solution on my end. My apologies for all the fuzz! |
Sorry to "necro-post", but I'm seeing this issue as well, but only when I import |
@twjacobsen - I ran into the same issue with |
I'm submitting a...
Current behavior
My apologies if this is a stupid question, I don't have a lot of xp with angular testing.
In my (jest powered) test I am trying to use the
toBeFocused()
matcher (cf. https://github.com/ngneat/spectator#custom-matchers) but it isn't found on the element retrieved by the query. The error is:What am I doing wrong?
Expected behavior
I think that toBeFocused() should be available for an HTMLInputElement?
Minimal reproduction of the problem with instructions
Environment
The text was updated successfully, but these errors were encountered: