linux-china / vitest-jetbrains-plugin

Vitest JetBrains plugin
https://plugins.jetbrains.com/plugin/19220-vitest-runner
Apache License 2.0
52 stars 6 forks source link

Monorepo issue with workspace directory #30

Closed belgattitude closed 2 years ago

belgattitude commented 2 years ago

Hey @linux-china

First of all, a huge thank you for this marvelous plugin.

In monorepos the cli don't run in the workspace directory but in the root which creates some issues. It's stange because when looking at the code it should actually work: https://github.com/linux-china/vitest-jetbrains-plugin/blob/main/src/main/kotlin/com/github/linuxchina/jetbrains/plugins/vitest/VitestBaseRunLineMarkerProvider.kt#L62

I'm using latest PhpStorm 2022.2.1 with latest vitest plugin.

Tested on this repo: https://github.com/belgattitude/nextjs-monorepo-example.

.
├── apps
│   └── nextjs-app      
│       ├── next.config.mjs
│       ├── package.json        
│       ├── tsconfig.json      
│       └── vitest.config.ts   ## CONFIG FOR  NEXTJS_APP WORKSPACE
│
├── packages
│   ├── core-lib                 
│   │   ├── src/
│   │   ├── CHANGELOG.md
│   │   ├── package.json
│   │   └── tsconfig.json
│   │   └── vitest.config.json   ## CONFIG FOR  CORE_LIB WORKSPACE
│   └── ui-lib                 
├── .yarnrc.yml
└── package.json        

Is it an issue on your side too ?

PS: a picture

image

When running the same command from the cli but in the workspace folder, it works

cd packages/core-lib/
/home/sebastien/.nvm/versions/node/v16.17.0/bin/yarn exec -- vitest -t usePromise packages/core-lib/src/hooks/__tests__/use-promise.test.tsx
linux-china commented 2 years ago

@belgattitude yes, I think it's a bug, and now the working directory is project root for workspaces. I adjusted working directory to package's directory. Could you try attached version? Thanks.

vitest-jetbrains-plugin-0.6.4.zip

belgattitude commented 2 years ago

Wow that was fast :smile: . It works perfectly, thanks for for quick support.

windylaugit commented 2 years ago

@belgattitude yes, I think it's a bug, and now the working directory is project root for workspaces. I adjusted working directory to package's directory. Could you try attached version? Thanks.

vitest-jetbrains-plugin-0.6.4.zip

I can't find the version(0.6.4) in the market. And the zip package does not support webstorm version: 2021.2.2

linux-china commented 2 years ago

@windylaugit Compatibility range of version 0.6.4 is 2021.3 — 2022.2.2 and 2021.2 is not compatible.

windylaugit commented 2 years ago

@windylaugit Compatibility range of version 0.6.4 is 2021.3 — 2022.2.2 and 2021.2 is not compatible.

Ok,I got it! Thinks!