vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Vitest VSCode extension doesn't give information about test files written in another language

Open haikyuu opened this issue 3 years ago • 3 comments

Describe the bug I'm writing my test files using Imba. I'm using the Imba plugin for Vite, so Vite and vitest handle them correctly. But I only see the file name in the tests pane.

To Reproduce Steps to reproduce the behavior on this example project:

  1. Run tests in the extension
  2. You will only see the test files

Expected behavior I would like to actually display the details from the test file

Screenshots image

How to?

I'm not sure about how you analyze the test files. But it would work if the extension analyzes the transformed files instead.

haikyuu avatar Sep 09 '22 07:09 haikyuu

I've opened up your sample repo - under .vscode's settings.json you need to configure vitest.include to include the file extensions of these files. The defaults are mentioned here: https://github.com/vitest-dev/vscode#config, and most notably don't include imba.

ColinKrist avatar Sep 09 '22 21:09 ColinKrist

Let me explain, here is a test and its exact compiled version

Imba includes sourcemaps with the compiled code, so they should be picked up by the extension

image

haikyuu avatar Sep 10 '22 07:09 haikyuu

I just found out that the extension uses babel to parse files and not Vite/Vitest

In order to support this feature, I believe we could hook into Vitest which already provides this information (example here that gets sourcemaps in the context of a reporter) instead of parsing files using babel.

haikyuu avatar Sep 10 '22 07:09 haikyuu

Probably related to my similar issue of tests written in ReScript.

https://github.com/vitest-dev/vscode/issues/127

jmagaram avatar Jan 26 '23 06:01 jmagaram

This is now supported in pre-release 0.5.0 and higher. Note that the extension now requires Vitest 1.4.0 or higher.

I am adding a "needs test" flag to make sure we don't introduce a regression later down the line.

sheremet-va avatar Mar 15 '24 17:03 sheremet-va