Missing test decorator or annotation
Quick summary
Your test function is not recognized by the test runner — it is missing the @test decorator or test() wrapper.
Why this happens
The test function is defined but not wrapped in test() or marked with @Test
The wrong test framework import is used, so the test function is not registered
The test function is defined inside another function and not at the top level
Minimal example
function addsTwoNumbers(a, b) {
expect(a + b).toBe(3); // not a registered test — never runs
}
addsTwoNumbers(1, 2);import { test, expect } from 'vitest';
test('adds two numbers', () => {
expect(1 + 2).toBe(3);
});Wrapping the assertion in test() registers it with the test runner so it is executed and reported.
How to diagnose
Check if the test function is wrapped in the test framework's test() or it() function
Verify the correct import from the test framework is used
Ensure the test function is at the top level of the describe block, not nested in another function
How to fix
Wrap the test function in test() or it() from the correct test framework
Import the test function from the correct framework: import { test } from 'vitest'
Move the test function to the top level of the describe block
How to prevent
Use the test framework's lint plugin to detect unregistered test functions
Follow a consistent test file structure with describe/test at the top level
Related Resources
Related Glossary
Related Lessons
- Test Basics
Learn test structure.