vitest icon indicating copy to clipboard operation
vitest copied to clipboard

fix(core): test change should trigger failed test rerun

Open btea opened this issue 2 years ago • 7 comments

fix #3687

btea avatar Jul 15 '23 02:07 btea

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
Latest commit 0d017c1ff805b84f6dc58a77de2573952fad410a
Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/64b543429c07560008f0d776

netlify[bot] avatar Jul 15 '23 02:07 netlify[bot]

  • The implementation doesn't seem to consider the filter enabled by pressing f? This PR should only affect that use case.

Maybe I misunderstood you guys? I thought that as long as the test content is modified, if there is a failed test case, it will automatically rerun.

I seem to understand that only after pressing f, if the content of the test file is modified, the failed test will be automatically run, is it?

btea avatar Jul 15 '23 08:07 btea

The issue contains two bugs:

  • When user has activated "Run only failed test"-filter in watch mode by pressing f, this filter does not preserve if files are modified
  • The "Run only failed test"-filter runs all test cases inside test files. It should run only failed test cases. Now it's only filtering the files.

If I didn't understand the error, it means that if a test file has test cases that fail, after pressing f, only the failed suite in the test file is re-run instead of the entire test file and all cases are re-run? (If so, filter test cases in a test file, I don't know how to do it, can you give me a hint? Thanks.)

And if the content of the file is modified, the failed test will not be filtered, and the original operation logic can be followed.

btea avatar Jul 21 '23 03:07 btea

(If so, filter test cases in a test file, I don't know how to do it, can you give me a hint? Thanks.)

I'm not 100% sure, but the changes should be made somewhere around packages/runner I think.

AriPerkkio avatar Jul 24 '23 06:07 AriPerkkio

Sorry, I can't seem to find any relevant instructions in the official documentation. Maybe I'm missing something. 🤔

@sheremet-va Can you give me a little hint? Thanks!

btea avatar Jul 30 '23 12:07 btea

@sheremet-va Can you give me a little hint? Thanks!

I'm not sure, but I think you can set configOverride.testNamePattern to filter tests (this is what vscode does) - maybe we should improve this somehow internally 🤷🏻

sheremet-va avatar Jul 01 '24 16:07 sheremet-va