marilari88 / neotest-vitest

Vitest adapter for Neovim Neotest plugin
106 stars 33 forks source link

Support configuring test extensions (eg: .vitest.ts) #26

Open justgage opened 1 year ago

justgage commented 1 year ago

I'm in a kind of weird situation where we're transitioning to vitest and thus have tests matched like this so we can run both jest and vitest (as we transition).

export default defineConfig({
  test: {
    include: ["**/*.vitest.{ts,tsx}"],
  },

But this plugin doesn't seem to make that configurable or inspect the config to figure that out. I admit parsing the config would be annoying so I think being able to configure which file extensions might be the best way forward.

justgage commented 1 year ago

I think this file might be where the config would be injected: https://github.com/marilari88/neotest-vitest/blob/main/lua/neotest-vitest/init.lua#L72

b0o commented 1 year ago

We're facing a similar issue, where we want to use neotest with in-source tests. Not all of our source files have inline tests, but some do. Parsing the config might be annoying, but I think it would be the best way to accomplish this.

Couto commented 1 year ago

This could also solve the problem of new module extensions like: .cjs, .mts, .cts, .mjs (which also includes the possibility of having a vitest.config.mts).

neotest-vitest fails to run on projects that use those. 😢