# Testing signals — vuejs/core

> Canonical page: https://codevetter.com/unpack/vue/testing-signals

# Testing signals — vuejs/core

Scanned commit 4ab865a848a1da3d10fb674f857e5fff13094644 (2026-09-18). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Vitest is the only test runner, with 196 spec files collocated in per-package `__tests__` directories and five projects configured in `vitest.config.ts` to isolate environment needs. Coverage is v8-based over `packages/*/src/**` with an explicit exclusion list that documents what is deliberately not unit-tested. Type correctness is tested separately by compiling `packages-private/dts-test` against generated `.d.ts` files, and treeshaking is asserted by a bespoke script. There is no mutation testing, no snapshot-free contract layer, and no coverage threshold gate in CI.
- Five Vitest projects are declared: `unit` (node env, excludes e2e and the DOM packages), `unit-gc` (forks pool with `--expose-gc` for two server-renderer specs), `unit-jsdom` (vue/vue-compat/runtime-dom), `e2e` (jsdom) and `e2e-browser` (real Chromium via `@vitest/browser-playwright`, only for Transition and TransitionGroup). — [vitest.config.ts#L47-L125](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/vitest.config.ts#L47-L125)
- Coverage explicitly excludes `packages/vue-compat/**`, `vue/src/dev.ts`, `vue/src/runtime.ts`, `runtime-core/src/profiling.ts`, `featureFlags.ts`, `customFormatter.ts`, and — with a comment saying they are covered by e2e instead — `hydrationStrategies.ts` and `runtime-dom/src/components/Transition*`. — [vitest.config.ts#L25-L45](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/vitest.config.ts#L25-L45)
- `scripts/setup-vitest.ts` installs three custom matchers — `toHaveBeenWarned`, `toHaveBeenWarnedLast`, `toHaveBeenWarnedTimes` — built on a mocked `console.warn`, which is the house idiom for asserting dev-only warning behaviour throughout the suite. — [scripts/setup-vitest.ts#L1-L60](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/scripts/setup-vitest.ts#L1-L60) [vitest.config.ts#L26-L30](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/vitest.config.ts#L26-L30)
- Every published package carries a `__tests__` directory (compiler-core, compiler-dom, compiler-sfc, compiler-ssr, reactivity, runtime-core, runtime-dom, runtime-test, server-renderer, shared, vue, vue-compat), totalling 196 `.spec.ts` files. — [packages/compiler-core/__tests__/compile.spec.ts](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/compiler-core/__tests__/compile.spec.ts) [packages/reactivity/__tests__/effect.spec.ts](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/reactivity/__tests__/effect.spec.ts) [packages/runtime-core/__tests__/components/Suspense.spec.ts](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/runtime-core/__tests__/components/Suspense.spec.ts)
- Compiler tests lean on snapshots (`__snapshots__` directories exist under compiler-core, compiler-dom and compiler-sfc), which means codegen changes surface as large snapshot diffs rather than assertion failures. — [packages/compiler-core/__tests__/__snapshots__](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/compiler-core/__tests__/__snapshots__) [packages/compiler-sfc/__tests__/__snapshots__](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/compiler-sfc/__tests__/__snapshots__)
- The e2e suite drives real browser behaviour across 14 specs including `todomvc.spec.ts`, `commits.spec.ts`, `markdown.spec.ts`, `grid.spec.ts`, `svg.spec.ts`, `vModel.spec.ts`, `memory-leak.spec.ts`, `ssr-custom-element.spec.ts` and `trusted-types.spec.ts`, with shared drivers in `e2eUtils.ts`/`e2eBrowserUtils.ts`. — [packages/vue/__tests__/e2e/todomvc.spec.ts](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/vue/__tests__/e2e/todomvc.spec.ts) [packages/vue/__tests__/e2e/memory-leak.spec.ts](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/vue/__tests__/e2e/memory-leak.spec.ts) [packages/vue/__tests__/e2e/trusted-types.spec.ts](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/vue/__tests__/e2e/trusted-types.spec.ts)
- `pnpm test-e2e` first builds the global dev bundle (`node scripts/build.js vue -f global -d`) and only then runs the e2e projects, so e2e results reflect the bundled artifact rather than the aliased source. — [package.json#L19](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/package.json#L19)
- Type-level testing is a separate pipeline: `test-dts` runs `build-dts` then type-checks `packages-private/dts-built-test` and `packages-private/dts-test`, whose ~20 `.test-d.ts(x)` files cover defineComponent, h, tsx, directives, inject, watch, scheduler, reactivity and custom elements. — [package.json#L20-L21](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/package.json#L20-L21) [packages-private/dts-test/package.json](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages-private/dts-test/package.json) [packages-private/dts-test/defineComponent.test-d.tsx](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages-private/dts-test/defineComponent.test-d.tsx)
- `scripts/verify-treeshaking.js` reads the built dev and prod bundles and asserts dead-code elimination; it runs in CI as a step of the e2e-test job, making it the guard for the `__DEV__`/`__FEATURE_*` flag scheme. — [scripts/verify-treeshaking.js#L1-L30](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/scripts/verify-treeshaking.js#L1-L30) [.github/workflows/test.yml#L93-L95](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/.github/workflows/test.yml#L93-L95)
- Test files get relaxed lint rules — `no-console`, `no-restricted-globals` and `no-restricted-syntax` are off under `**/__tests__/**` — but `vitest/no-disabled-tests` and `vitest/no-focused-tests` are errors, so a stray `.only` or `.skip` fails the lint job. — [eslint.config.js#L80-L102](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/eslint.config.js#L80-L102)
- Benchmarks are first-class: `prebench` builds reactivity as esm-browser and `bench`/`bench-compare` run `vitest bench --project=unit` writing to and diffing against `temp/bench.json`. — [package.json#L27-L30](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/package.json#L27-L30)
- CI does not enforce a coverage threshold — `test-coverage` exists as a script but no workflow invokes it; the jobs run `test-unit`, `test-e2e`, lint, `check` and `test-dts` only. — [package.json#L22](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/package.json#L22) [.github/workflows/test.yml#L1-L125](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/.github/workflows/test.yml#L1-L125)
- The most recent commit follows the repo's expected pattern of pairing a runtime fix with a regression test: `fix(suspense): skip rendering async components unmounted while pending` changed 3 lines in `Suspense.ts` and added 56 lines to `Suspense.spec.ts`. — [packages/runtime-core/src/components/Suspense.ts#L750-L775](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/runtime-core/src/components/Suspense.ts#L750-L775) [packages/runtime-core/__tests__/components/Suspense.spec.ts](https://github.com/vuejs/core/blob/4ab865a848a1da3d10fb674f857e5fff13094644/packages/runtime-core/__tests__/components/Suspense.spec.ts)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
