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

vitest.exclude not working #60

Closed
xmlking opened this issue Jul 19, 2022 · 4 comments
Closed

vitest.exclude not working #60

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

Comments

@xmlking
Copy link

xmlking commented Jul 19, 2022

vitest.exclude not working, VSCode UI still show vitest exclude tests

image

I have settings.json

	////////// vitest //////////
	"vitest.include": ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx,svelte}"],
	"vitest.exclude": ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/ignored.test.ts", "tests/**"],
import { sveltekit } from '@sveltejs/kit/vite';
import path from 'path';
import { configDefaults, defineConfig } from 'vitest/config';

/** @type {import('vite').UserConfig} */
export default defineConfig({
	define: {
		// Eliminate in-source test code
		'import.meta.vitest': 'undefined'
	},

	test: {
		// jest like globals
		globals: true,
		environment: 'jsdom',
		// in-source testing
		includeSource: ['src/**/*.{js,ts,svelte}'],
		exclude: [...configDefaults.exclude, 'tests'],
		// msw setup
		setupFiles: ['./src/mocks/setup.ts'],
		coverage: {
			exclude: ['src/mocks']
		},
		deps: {
			// Put Svelte component here, e.g., inline: [/svelte-multiselect/, /msw/]
			inline: [/msw/]
		}
	},

	resolve: {
		alias: {
			$stores: path.resolve('./src/lib/stores'),
			$blocks: path.resolve('./src/lib/blocks')
		}
	},
	envPrefix: ['VITE_', 'CONFY_'],

	plugins: [sveltekit()]
});
@xmlking xmlking added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jul 19, 2022
zxch3n added a commit that referenced this issue Jul 23, 2022
@zxch3n
Copy link
Member

zxch3n commented Aug 6, 2022

Fixed

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

xmlking commented Dec 13, 2022

still not working
settings
image
Before Refresh (working)
image
After clicking Refresh Tests button (not working)
image

@zxch3n zxch3n reopened this Feb 9, 2023
@timoweave
Copy link
Contributor

Hey @zxch3n ,
Could you also fix discoverAllTestFilesInWorkspace
in line 113 of flie src/discover.ts, like how you fix
watchAllTestFilesInWorkspace in commit 9cd3218, please?

-            exclude.every(x => !minimatch(v.fsPath, x, { dot: true }))
+            exclude.every(x => !minimatch(path.relative(workspacePath, v.fsPath), x, { dot: true }))

@MilanKovacic
Copy link
Collaborator

New version of extension has been released on https://marketplace.visualstudio.com/items?itemName=vitest.explorer. Please try it out, and if the issue still persists, feel free to open a new one.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 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

4 participants