Skip to content

Glossary ​

The words these docs use, in plain terms. Each entry says what the word means in a spec and, where it helps, which function it points to. The last column is the term the Russian pages use.

Spies and doubles ​

TermMeaningRU
spyA stand-in function. It records every call and answers what you set. createSpyFromClass(UserService) gives an object whose every method is a spy.спай
Spy<T>The type of that object: every method of T typed as a spy, plus the helpers its return type allows (resolveWith, nextWith, …).Spy<T>
test doubleAny object that stands in for a real dependency in a test. A spy object is one kind.подмена, тестовый дубль
stubA double that only answers with preset values and records nothing. createMock<T>() builds one.стаб
mockA double told in advance which calls to expect; it fails on the others. mustBeCalledWith and strict turn a spy into one.мок
fakeA working, simplified implementation, such as an in-memory store. This library does not build fakes.фейк
fixtureA ready test object with sensible defaults, such as a User with every field filled. See Fixtures without casts.фикстура
preset (returns)Setting a spy's answer when you create it, instead of on a later line: createSpyFromClass(UserService, { returns: { load: of(user) } }).задать заранее
overridesReplacing a member with a plain value that is no longer a spy. See returns vs overrides.overrides
strictA mode where a method you did not configure throws instead of returning undefined. See Strict mode.строгий режим
lazy spyA method spy built on first read rather than up front. It saves memory on wide classes and behaves the same in a spec.ленивый спай
helperA method the library adds to a spy, such as resolveWith, nextWith or calledWith. See Control helpers.хелпер

Packages and setup ​

TermMeaningRU
entry pointThe import path you pick for your runner or framework: vitest-auto-spy, vitest-auto-spy/angular, vitest-auto-spy/bun. See Entry points.точка входа
runner adapterThe link between the library and your runner's mock function (vi.fn(), Bun's mock(), node:test's mock.fn()). Importing an entry point registers it.адаптер раннера
setup fileA file your runner loads before every spec file, such as vitest.setup.ts listed in setupFiles. Global switches go there.setup-файл
spec fileOne test file, such as user.service.spec.ts.спека, файл теста
suiteAll the tests of a project, or the tests of one describe block.набор тестов
peer dependencyA package the library uses but does not install; your project provides it. All of them are optional here.peer-зависимость
externalizeVitest loads a package from node_modules as is instead of processing it with the rest of your code. Angular can then end up with two copies of @angular/core/testing.вынести из обработки
inlineThe opposite: Vitest processes the package with your code, so it shares one copy of each dependency (server.deps.inline).инлайнить
type augmentationAdding members to a library's types from your own code with declare module.расширение типов

Angular ​

TermMeaningRU
TestBedAngular's test module. It builds components and services with real dependency injection (DI).TestBed
providerAn entry in providers: [...] that tells DI what to hand out for a class or token. provideAutoSpy(UserService) is one.провайдер
injectGetting an instance from DI, with inject() or TestBed.inject(). injectSpy(UserService) does the same and returns it typed as Spy<UserService>.получить через DI
zonelessAngular without zone.js. Change detection runs on signals, and fakeAsync is not available.zoneless
shallow renderRendering a component with its child components replaced by empty stand-ins. See renderShallow on the Angular page.поверхностный рендер
standaloneA component that lists its own imports instead of belonging to an NgModule. A spec puts it in TestBed's imports.standalone-компонент
unit-test builderAngular CLI's @angular/build:unit-test, which runs Vitest from ng test.билдер unit-test

Runtime words ​

TermMeaningRU
instantiateCreate an instance with new. The library never does this to the class you spy on, so its constructor does not run.создать экземпляр
prototypeThe object that holds a class's methods. The library reads it to find the methods to spy on.прототип
instance fieldA property set in the constructor or as name = value in the class body. It is not on the prototype, so it needs its own option.поле экземпляра
isolate: falseA Vitest option that runs many spec files in one shared environment. Faster, but a global left changed by one file leaks into the next.isolate: false

Released under the MIT License.