( val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, )
| 15 | const SPACE = ' ' |
| 16 | |
| 17 | export const serialize: NewPlugin['serialize'] = ( |
| 18 | val: any, |
| 19 | config: Config, |
| 20 | indentation: string, |
| 21 | depth: number, |
| 22 | refs: Refs, |
| 23 | printer: Printer, |
| 24 | ) => { |
| 25 | const stringedValue = val.toString() |
| 26 | |
| 27 | if ( |
| 28 | stringedValue === 'ArrayContaining' |
| 29 | || stringedValue === 'ArrayNotContaining' |
| 30 | ) { |
| 31 | if (++depth > config.maxDepth) { |
| 32 | return `[${stringedValue}]` |
| 33 | } |
| 34 | return `${stringedValue + SPACE}[${printListItems( |
| 35 | val.sample, |
| 36 | config, |
| 37 | indentation, |
| 38 | depth, |
| 39 | refs, |
| 40 | printer, |
| 41 | )}]` |
| 42 | } |
| 43 | |
| 44 | if ( |
| 45 | stringedValue === 'ObjectContaining' |
| 46 | || stringedValue === 'ObjectNotContaining' |
| 47 | ) { |
| 48 | if (++depth > config.maxDepth) { |
| 49 | return `[${stringedValue}]` |
| 50 | } |
| 51 | return `${stringedValue + SPACE}{${printObjectProperties( |
| 52 | val.sample, |
| 53 | config, |
| 54 | indentation, |
| 55 | depth, |
| 56 | refs, |
| 57 | printer, |
| 58 | )}}` |
| 59 | } |
| 60 | |
| 61 | if ( |
| 62 | stringedValue === 'StringMatching' |
| 63 | || stringedValue === 'StringNotMatching' |
| 64 | ) { |
| 65 | return ( |
| 66 | stringedValue |
| 67 | + SPACE |
| 68 | + printer(val.sample, config, indentation, depth, refs) |
| 69 | ) |
| 70 | } |
| 71 | |
| 72 | if ( |
| 73 | stringedValue === 'StringContaining' |
| 74 | || stringedValue === 'StringNotContaining' |
nothing calls this directly
no test coverage detected