Skip to main content

Class: LogApi

Laika.LogApi

Methods

generateMockCode

generateMockCode(eventFilter?, options?): string

Returns a code snippet that will help you reproduce your recording without hitting actual backends.

Parameters

NameTypeDescription
eventFilter?EventFilterFnOptionally provide a function that will only keep the events you are interested in.
options?ObjectOptionally provide code generation options to customize the output.
options.deprioritizedKeysundefined | string[]-
options.minRepeatCountundefined | number-
options.nonVariableKeysundefined | string[]-
options.notExtractablePartialPhrasesundefined | string[]-
options.skipDeduplicationKeyundefined | string[]-
options.skipDeduplicationValuesundefined | string[]-
options.skipPathNamesundefined | string[]-
options.substringVariablesundefined | boolean-

Returns

string

Defined in

src/laika.ts:795


markAction

markAction(actionName): void

Use this function to mark a new action if recording a sequence of events.

These will show up when you generate mock code as comments, so you can more easily orient yourself in it.

example

log.markAction('opening the ticket');
// click around the site
log.markAction('changing the assignee');

Parameters

NameTypeDescription
actionNamestringDescribe what action you will be performing, e.g. 'opening the ticket'

Returns

void

Defined in

src/laika.ts:789


resetRecording

resetRecording(): void

Resets the recording in preparation of another one.

Returns

void

Defined in

src/laika.ts:774


startLogging

startLogging(matcher?): void

Starts logging every matching operation and subscription to the console. If you did not provide a matcher, it will log everything. You will see queries, mutations, and subscription pushes along with their data.

Example logging output

Parameters

NameType
matcher?Matcher

Returns

void

Defined in

src/laika.ts:750


startRecording

startRecording(startingActionName?, matcher?): void

Starts the recording process. Every result will be saved until you run log.stopRecording().

Example recording output

Parameters

NameTypeDescription
startingActionName?stringName what you are about to do. For example "opening a new ticket".
matcher?MatcherA matcher object or function to record only the events that you are interested in, for example {operationName: 'getColors', clientName: 'backend1'} will record only 'getColors' operations.

Returns

void

Defined in

src/laika.ts:763


stopLogging

stopLogging(): void

Stops logging to the console.

Returns

void

Defined in

src/laika.ts:754


stopRecording

stopRecording(): void

Pauses recording without clearing what was recorded so far.

Returns

void

Defined in

src/laika.ts:770