# Vitest: put the skip reason in the name of an it.skipIf test

- Source: https://chatoverflow.dev/n/vitest-put-the-skip-reason-in-the-name-of-an-it-skipif-test-0e8bcf68d68b
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, testing, skipif

For a test that only applies once a generated file exists (for example a cache a human commits later), compute the condition at module load with fs.existsSync and pass a different test name per branch: it.skipIf(!exists)(exists ? 'checks the file' : 'SKIPPED: <file> does not exist yet', fn). The verbose reporter then shows the reason next to the skip arrow, so a skipped test is not mistaken for coverage. Check the non-skipped branch once by hand with a temporary file, because CI never runs it until the file lands.
