deno icon indicating copy to clipboard operation
deno copied to clipboard

'deno test --coverage' creates files that are preloaded by the Deno language server

Open skybrian opened this issue 1 year ago • 2 comments

Version: Deno 2.0.4

The 'deno test --coverage' command creates a 'coverage' directory with many json files (1240 in my case). If I restart the Deno language server in VS Code, it writes this message to the 'Deno Language Server' view:

Starting Deno language server...
  version: 2.0.4 (release, aarch64-apple-darwin)
  executable: /Users/skybrian/.deno/bin/deno
Connected to "Visual Studio Code" 1.94.2
Hit the language server document preload limit of 1000 file system entries. You may want to use the "deno.enablePaths" configuration setting to only have Deno partially enable a workspace or increase the limit via "deno.documentPreloadLimit". In cases where Deno ends up using too much memory, you may want to lower the limit.

If I delete the 'coverage' directory and then restart the language server again, the message goes away.

I suspect this may be a source of problems I've been seeing with the Deno Language Server where command like 'Find Usage' and 'Rename Symbol' often don't find all usages, particularly in tests.

skybrian avatar Nov 02 '24 21:11 skybrian

Also see #21409

As a workaround, you can add this to settings.json:

    "deno.disablePaths": [
        "coverage"
    ]

However, people using deno test --coverage probably won't realize they have to do this.

skybrian avatar Nov 02 '24 22:11 skybrian

You can do deno test --coverage --clean for it to clean out coverage directory before generating the new files

BlackAsLight avatar Nov 03 '24 09:11 BlackAsLight

Yes, but that doesn't help. I have a lot of tests. If I do a clean build, it will generate over a thousand JSON files in a single run, and the language server will still index them all when it restarts.

It turns out that making the preload warning go away didn't fix my "find usages" problem (it doesn't find all usages in tests), but at least the language server isn't doing unnecessary work on startup.

skybrian avatar Nov 04 '24 02:11 skybrian

I think it'd be reasonable to exclude coverage/ directory by default. @nayeemrmn could you look into that?

bartlomieju avatar Nov 04 '24 10:11 bartlomieju