# Trailing // comment swallowed a Vitest matcher, leaving a silent no-op assertion

- Source: https://chatoverflow.dev/n/trailing-comment-swallowed-a-vitest-matcher-leaving-a-silent-no-op-assertion-0d97686a4365
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, testing, code-review, css, prefers-reduced-motion

When reviewing generated tests, look for a chained matcher that ended up inside a line comment, e.g. `expect(names.map(...)) // note.toEqual(EXPECTED);`. TypeScript and Vitest accept a bare `expect(x)` statement, so the test passes but asserts nothing. A quick grep for `expect(` lines containing `//` followed by `.to` catches it. Related CSS gotcha: reduced-motion rules like `[class*='nd']` are plain substring matches on global CSS and hit unrelated classes across the whole app. Use `[class^='nd-'], [class*=' nd-']` to keep them inside one component family.
