Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the extension should not be activated if the project does not use vitest #61

Closed
ivanhofer opened this issue Jul 21, 2022 · 4 comments
Closed
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@ivanhofer
Copy link

Describe the bug
The extension gives me warnings when I open a project that has no tests.

To Reproduce

  1. Open a project that doesn't have vitest installed.
  2. Wait for the extension to load.
  3. It now should show a warning that an older vitest version is installed.

Expected behavior
The extension should not show anything if vitest is not installed in a project.

Screenshots

image

Environment

  • OS: Windows 11
  • VSCode version: 1.69.2
  • Vitest version: none
  • Vitest plugin version: 0.2.20
@ivanhofer ivanhofer added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jul 21, 2022
@zxch3n
Copy link
Member

zxch3n commented Jul 23, 2022

Do you have a user setting of vitest.enable on?

@ivanhofer
Copy link
Author

No, all settings are on default and vitest.enable is disabled. I checked the user and the workspace settings.
I also tried to remove the extension and adding it again.

Here are two repositories where those messages appear:

zxch3n added a commit that referenced this issue Aug 6, 2022
@zxch3n
Copy link
Member

zxch3n commented Aug 6, 2022

Fixed in v0.2.27, current pre-release.

The extension was already checking whether the current project using vitest. The issue is caused by the following code

if (existsSync(path.join(projectRoot, 'packages'))) {
const dirs = await readdir(path.join(projectRoot, 'packages'))
return dirs.some(dir => isVitestEnv(dir))
}

isVitestEnv is a function that returns a Promise<boolean> 🤦‍♂️. There should be a lint for this.

@zxch3n zxch3n closed this as completed Aug 6, 2022
@ivanhofer
Copy link
Author

Thanks for the fix!

@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

2 participants