Error: No test suite found
Describe the bug
not sure what is happening, but if I comment the console.log() the test is fine, if that line is uncommented I get Error: No test suite found in file ...
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-7ztept?devtoolsheight=33&file=test/index.test.ts
System Info
System:
OS: macOS 12.1
CPU: (10) arm64 Apple M1 Pro
Memory: 139.27 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node
Yarn: 1.22.15 - ~/.nvm/versions/node/v15.14.0/bin/yarn
npm: 7.7.6 - ~/.nvm/versions/node/v15.14.0/bin/npm
Browsers:
Chrome: 98.0.4758.109
Edge: 98.0.1108.62
Firefox: 96.0.3
Safari: 15.2
npmPackages:
@vitejs/plugin-react: ^1.2.0 => 1.2.0
vitest: ^0.5.5 => 0.5.5
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Can you try the same with the previous version ("vitest": "0.5.4")?
I think that the last release (0.5.5) is shadowing real errors.
Can confirm errors are not shadowed on 0.5.4 with the following config (and a Failed to resolve import "@testing-library/jest-dom" from "src/test/setup.ts" shadowed error with 0.5.5)
/// <reference types="vitest" />
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
threads: false,
watch: false,
include: ['**/__tests__/*.{js,tsx,ts}'],
setupFiles: './src/test/setup.ts'
}
})
Yah, I can also confirm I was getting these No test suite found errors on 0.5.5, I downgraded to 0.5.4 and saw the actual error messages, fixed them, upgraded back up to 0.5.5 and everything passes.
Ran into the same issue! Particularly with trying to call the following:
import { mount } from "@vue/test-utils"
In my case, it was as dumb of an error as forgetting to install the base test packages, but I couldn't deduce from the test output.
Downgraded from 0.5.5 to 0.5.4 which fixed it.
Looks like the no test suite found error masking is fixed in the latest release
This was fixed, closing issue.
I have the same error with the next config, I have tried to change the version but I cant see where is the trouble:
{ "devDependencies": { "standard": "^17.0.0", "vitest": "^0.23.1" }, "eslintConfig": { "extends": "./node_modules/standard/eslintrc.json" }, "name": "advent-js-tdd", "version": "1.0.0", "main": "index.js", "type": "module", "dependencies": { "acorn": "^8.8.0", "assertion-error": "^1.1.0", "chai": "^4.3.6", "check-error": "^1.0.2", "debug": "^4.3.4", "deep-eql": "^3.0.1", "esbuild": "^0.15.7", "esbuild-windows-64": "^0.15.7", "function-bind": "^1.1.1", "get-func-name": "^2.0.0", "has": "^1.0.3", "is-core-module": "^2.10.0", "local-pkg": "^0.4.2", "loupe": "^2.3.4", "ms": "^2.1.2", "nanoid": "^3.3.4", "path-parse": "^1.0.7", "pathval": "^1.1.1", "picocolors": "^1.0.0", "postcss": "^8.4.16", "resolve": "^1.22.1", "rollup": "^2.78.1", "source-map-js": "^1.0.2", "strip-literal": "^0.4.0", "supports-preserve-symlinks-flag": "^1.0.0", "tinybench": "^2.1.5", "tinypool": "^0.2.4", "tinyspy": "^1.0.2", "type-detect": "^4.0.8", "vite": "^3.1.0" }, "scripts": { "test": "vitest", "coverage": "vitest run --coverage" }, "keywords": [], "author": "", "license": "ISC", "description": "" }
And the test script:

In my case i've just changed the path to the project and now it works
Please reopen this, it's still an issue if the root project folder doesn't match the package name by case. In my case, the folder was "Engine", the package name was "engine".
By default the test suite is the workspaceRoot. If that is not the case I recommend you hardcode the path.
Hi all,
I'm currently experiencing this issue:

v0.26.0 fixed this for me again 👍🏿
Experiencing this when upgrading to v0.26.1. It was not happening on the codebase with v0.25.2. Running in a monorepo and the folder name does not match package name so tried setting root and that did not help.
Running MacOS.
Experiencing this when upgrading to v0.26.1. It was not happening on the codebase with v0.25.2. Running in a monorepo and the folder name does not match package name so tried setting root and that did not help. Running MacOS.
Seeing similar behaviour with 0.26.1.
Can you please just open a new issue with reproduction? Commenting in closed issues doesn’t help maintainers.
I'm noticing this issue when using pnpx (Monorepo using pnpm, my working directory is inside a library next to the testfile like project/packages/a/src/foo/, running pnpx vitest foo.spec.ts), using npx, vitest works fine.
Also running into this error on vitest v0.26.3. Some of my tests are working, but in one directory of my repo, tests just will not run. Even something as basic as:
import { describe, expect, it } from 'vitest';
describe('A nascent test',()=>{
it('Really basic test',()=>{
expect(true).toBe(true);
})
});
The above fails in one directory, but I have full test suits running fine in another. The error I get is:
Error: No test suite found in file E:/Git/Kurohyou_studios/Roll20-Snippets/test_sheet/source/assets/js/__tests__/gen.test.js
Please reopen this, it's still an issue if the root project folder doesn't match the package name by case. In my case, the folder was "Engine", the package name was "engine".
Same here, in package.json the project name was DigiLab. When i've cloned it on my another notebook i typed 'digilab' and it gave me this error. After change the folder name it was fixed
I changed the include property back and forth until it found the tests.
change vitest to npx vitest work for me