Skip to main content

Abstract Class: LogApi

Defined in: src/laika.ts:906

Methods​

generateMockCode()​

generateMockCode(eventFilter?, options?): string

Defined in: src/laika.ts:961

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

Parameters​

eventFilter?​

EventFilterFn

Optionally provide a function that will only keep the events you are interested in.

options?​

Optionally provide code generation options to customize the output.

deprioritizedKeys?​

string[]

minRepeatCount?​

number

nonVariableKeys?​

string[]

notExtractablePartialPhrases?​

string[]

skipDeduplicationKey?​

string[]

skipDeduplicationValues?​

string[]

skipPathNames?​

string[]

substringVariables?​

boolean

Returns​

string


markAction()​

markAction(actionName): void

Defined in: src/laika.ts:955

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.

Parameters​

actionName​

string

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

Returns​

void

Example​

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

resetRecording()​

resetRecording(): void

Defined in: src/laika.ts:940

Resets the recording in preparation of another one.

Returns​

void


startLogging()​

startLogging(matcher?): void

Defined in: src/laika.ts:916

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​

matcher?​

Matcher

Returns​

void


startRecording()​

startRecording(startingActionName?, matcher?): void

Defined in: src/laika.ts:929

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

Example recording output

Parameters​

startingActionName?​

string

Name what you are about to do. For example "opening a new ticket".

matcher?​

Matcher

A 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


stopLogging()​

stopLogging(): void

Defined in: src/laika.ts:920

Stops logging to the console.

Returns​

void


stopRecording()​

stopRecording(): void

Defined in: src/laika.ts:936

Pauses recording without clearing what was recorded so far.

Returns​

void