ionide / ionide-vscode-fsharp

VS Code plugin for F# development
http://ionide.io
MIT License
849 stars 276 forks source link

Test runner conflicts with other test runners when running a single test in Continous Run #1995

Closed MangelMaxime closed 3 months ago

MangelMaxime commented 3 months ago

Describe the bug

In my project, I am using both F# via Fable and Vitest as my test runner because I need to run the tests on JavaScript.

It looks like because Ionide set its Run F# tests as a default profile this conflict with Vitest Continuous Run for a single test.

You can find the discussion history on there repo https://github.com/vitest-dev/vscode/issues/287

I am unsure if the problem is with Ionide or Vitest extension.

Steps to reproduce

  1. Clone glutinum-org/cli@vitest_continous_mode_bug

    Make sure to select the correct branch, otherwise you will need to generate the tests files etc.

  2. pnpm install

  3. Open VSCode (with both Ionide and Vitest)

  4. Try to run the tests using Vitest UI + Continuous mode

Expected behaviour

Expected behaviour depends, on where the source of the issue is 😅.

I believe right now, the test request is passed to Ionide. If this is the case, then Ionide should notify the user that something is wrong is the test is not an F# test or forward the tests to the next test runner is possible.

I think the first approach is good enough and will help the user think about choosing a Test profile.

Machine info

Additional context

Add any other context about the problem here.

baronfel commented 3 months ago

we do set the Run F# tests profile as the default - this happens at https://github.com/ionide/ionide-vscode-fsharp/blob/e607bdfcd34522e24299a525379f0ed8fb828c6f/src/Components/TestExplorer.fs#L1802-L1804

We could change that - what behavior happens when you try to run tests with no default profile selected?

MangelMaxime commented 3 months ago

We could change that - what behavior happens when you try to run tests with no default profile selected?

Great question as I cannot have a no default profile selected once one is selected. Let me build a local version of Ionide to test it out.

baronfel commented 3 months ago

It looks like we can use 'tags' to target test run profiles - perhaps vite should consider tagging their discovered tests, and we should consider tagging our discovered tests as well. A brief description of how this works is here: https://code.visualstudio.com/api/extension-guides/testing#test-tags

MangelMaxime commented 3 months ago

I can't seems to find a way to not have a Default profile selected.

I tried to create a new folder on my machine in case this was due to as cache but no nothing seems to allow me to not have a default profile selected.

However, if both F# and Vitest are selected as default then it works: https://github.com/vitest-dev/vscode/issues/287#issuecomment-2002028260

The test 'tags', seems interesting indeed.

MangelMaxime commented 3 months ago

I am closing because it seems like the problem is how Vitest is implemented.

I will re-open if needed.

Thank you for looking into it Chet