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

Run(Vitest) link fails for tests under sub-folders ("No test files found") #7

Open
n8allan opened this issue Dec 5, 2022 · 4 comments

Comments

@n8allan
Copy link

n8allan commented Dec 5, 2022

My folder structure is like this:

/
  vite.config.js
  src/
    lib/
      tree/
        btree.test.ts

vite.config.js looks like this:

import { sveltekit } from '@sveltejs/kit/vite';

/** @type {import('vite').UserConfig} */
const config = {
	plugins: [sveltekit()],
	test: {
		include: ['src/**/*.{test,spec}.{js,ts}']
	}
};

export default config;

When I click on Run(Vitest) from btree.test.ts, the terminal includes a "cd" to the /src/lib/tree folder where npx... is ran. As a result, I get "No test files found". The error says the include is src/**/*.{test,spec}.{js,ts} so I assume that the problem is that relative to the path where the test file is, there is indeed no "src" sub-folder.

@adamhill86
Copy link

I'm having the same issue.

vite.config.ts

import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';

const config: UserConfig = {
  plugins: [sveltekit()],
    test: {
      include: ['src/**/*.{test,spec}.{js,ts}']
    }
};

export default config;

@rluvaton
Copy link

@VanCoding
Copy link

For me, it works when using absolute paths like this:

include: [__dirname+'/src/**/*.{test,spec}.{js,ts}']

@rluvaton
Copy link

rluvaton commented Aug 3, 2023

forked and published my own package given this is not maintained https://marketplace.visualstudio.com/items?itemName=rluvaton.vscode-vitest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants