V13Axel / neotest-pest

Neotest adapter for Pest 2.0
MIT License
20 stars 6 forks source link

False negative for tests with datasets #3

Open V13Axel opened 9 months ago

V13Axel commented 9 months ago

If a test has ->with(), it technically changes into multiple tests. As such, passes are detected as failures:

2024-02-20_16-48

I'm guessing it's because the test ID(s) rely on the string passed to it() or test(), and expect that 1 it() or test() === 1 test. When using datasets, that's not the case. Hrm.

Will need to chew on how to actually handle that in the context of this adapter.

V13Axel commented 8 months ago

After looking into this a bit further, it appears the term used for this elsewhere is "parameterized" tests, and neotest does support them. I'll be looking into the way neotest-jest handles them for inspiration, and hope to have that solved sometime in the near future.

anhoder commented 7 months ago

+1

calebdw commented 5 months ago

I want to point out that the same problem also happens when using `->repeat()

image

V13Axel commented 5 months ago

Thanks @calebdw - I've been experimenting with this a bit already, so knowing that will help me make things a bit more generalized

sixlive commented 4 months ago

Any headway on this?

V13Axel commented 4 months ago

@sixlive nothing concrete yet, though I continue to experiment with it. I'll definitely post an update here just as soon as there is something to share!

V13Axel commented 4 months ago

... After quite a few hours and a number of attempts at test discovery using tree-sitter, I have discovered that there is a --list-tests flag that can be passed to both pest and phpunit that will generate a list of tests - and it even lists parameterized tests separately!

I'm not 100% sure what that might end up looking like here either, but I'll be evaluating it as a path forward.

sixlive commented 4 months ago

Awesome, thanks for the update. I was hacking around on it last weekend and was also struggling trying to get things working via tresitter. I think the --list-tests is a promising way forward. Might try hacking on it again this weekend if I end up with some free time. I'll post back if I end up with anything interesting.

victor-falcon commented 2 weeks ago

I'm facing this issue with a normal it test… 🤔

image