-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
"No test suite found in file" error in GitHub action #3393
Description
Describe the bug
I'm getting a "No test suite found in file..." error when I run vitest in my GitHub action. I'm running vitest programmatically using - here is the source code. I've made a custom reporter to report the errors in the Files sections of the GitHub PR once the action has run successfully.
As you can see in the following screenshot, upon running the action, the afore-mentioned error is reported.

I initially thought it might be a an issue with multiple vitest runtimes (as is the case in multiple similar resolved issues on this repository), but from what I can tell, there's a single vitest runtime, since the action.mjs file doesn't bundle the vitest source, and instead imports it from the node_modules in the user's project (the project using the action).
It is worth noting that if I use ./ instead of roerohan/vitest-github-action (as I'm running the action in the same repository where it's defined) within the repository to run my action, it works perfectly, as you can see in this PR.
Summary of links:
- PR that uses
roerohan/vitest-github-action: https://github.com/roerohan/vitest-github-action/pull/10/files - PR that uses
./: https://github.com/roerohan/vitest-github-action/pull/11/files
Reproduction
You can easily report this by writing a small action in any repository that uses vitest. I've added the YAML configuration for the action below
name: "Run vitest tests"
on:
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Run `npm install`
run: |
npm install
npm run build
- name: Run vitest and report issues
uses: roerohan/vitest-github-action@v1
with:
config: ./vitest.config.tsYou can alternatively check out this PR if you'd like to see a sample reproduction of the issue.
System Info
System:
OS: Linux 6.1 Manjaro Linux
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Memory: 4.68 GB / 14.99 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 19.8.1 - ~/.nvm/versions/node/v19.8.1/bin/node
npm: 8.19.4 - ~/Documents/Repos/vitest-github-action/node_modules/.bin/npm
Browsers:
Chrome: 108.0.5359.124
Firefox: 112.0
npmPackages:
vitest: ^0.31.0 => 0.31.0Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.