vitest-cucumber icon indicating copy to clipboard operation
vitest-cucumber copied to clipboard

Error on test file save

Open charlieforward9 opened this issue 1 year ago • 11 comments
trafficstars

A few seconds after saving (Ctrl+S) my test file - a feature file <path> doesn't exist error shows in the Vitest VSCode test bar.

image

When this happens, I am unable to run the tests in the file. To reset this error state, I either have to click the Refresh Tests or Run All Tests button. If I try to run tests on the file when the error message is shown, the test does not run:

image

charlieforward9 avatar May 17 '24 15:05 charlieforward9

Ok, I've an idea of this bug. Jus a question, in your test file, do you use loadFeatures with relative path ? Like loadFeatures("../test.feature") or not relative like loadFeatures("dir/test.feature") ?

amiceli avatar May 17 '24 19:05 amiceli

I use the path relative to the root of the repository. I also use the singular loadFeature method.

Ex. loadFeature("src/....../test.feature")

charlieforward9 avatar May 17 '24 21:05 charlieforward9

Ok, I found the bug, I'm working on it.

amiceli avatar May 19 '24 08:05 amiceli

@charlieforward9 I publish a new beta version 3.3.1-beta.1. I tested it in some projects, when I save tests feature file is found. You can test it ;).


Another thing, when I update a test, for example expect(str).toContain("vue") to expect(str).not.toContain("vue"). On VsCode nothing change unless I re-run tests, both passed. Do you have same thing ?

I think isn't due to vitest-cucumber but vitest on VsCode, but I don't know why.

amiceli avatar May 22 '24 20:05 amiceli

Thank you, I'll take a look at it.

I never noticed this inconsistency in my code. I typically run the tests every time I make a change. Have not gotten into the habit of watching output yet.

We just onboarded @sainaruufl who will take charge of our testing development practices. He will be using this library as the default structure for our BDD (e2e) tests.

We are also using React Testing Library by default. We are exploring the interoperability of both libraries to improve our workflow.

I look forward to the future of this!

charlieforward9 avatar May 22 '24 21:05 charlieforward9

Ok, we can forget bug I found ;) If feature file not found fix is ok for you, I'll close this issue.

amiceli avatar May 23 '24 08:05 amiceli

Both myself and @sainaruufl experienced this error in 3.3.1-beta.2

charlieforward9 avatar May 25 '24 01:05 charlieforward9

You still have file not found error in vitest VsCode ?

amiceli avatar May 26 '24 11:05 amiceli

Yes, we have not updated our version since 3.3.1-beta.2 and still see this.

charlieforward9 avatar May 29 '24 14:05 charlieforward9

I've rebased this bug branch. I'm testing changes about this error in vscode ;).

amiceli avatar Jul 28 '24 12:07 amiceli

I tried with a new beta version 3.5.1-beta.1. When I changes tests, for example, expect(true).toBe(false) to expect(true).toBe(true). Vitest detect changes and I havn't an error about feature file.

Do you still have an error ?

This version required vitest >=2.0.0 ;).

amiceli avatar Jul 28 '24 12:07 amiceli

I close this issue, i'll re-open if I have any feedback

amiceli avatar Sep 05 '24 19:09 amiceli

@amiceli Looks like an issue similar to this arises in browser mode.

charlieforward9 avatar Jan 13 '25 22:01 charlieforward9