Skip to content

"No test suite found in file" error in GitHub action #3393

@roerohan

Description

@roerohan

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.
image

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:

  1. PR that uses roerohan/vitest-github-action: https://github.com/roerohan/vitest-github-action/pull/10/files
  2. 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.ts

You 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.0

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions