( node: ReactNode, options?: NodeJS.WriteStream | RenderOptions, )
| 74 | * Mount a component and render the output. |
| 75 | */ |
| 76 | export const renderSync = ( |
| 77 | node: ReactNode, |
| 78 | options?: NodeJS.WriteStream | RenderOptions, |
| 79 | ): Instance => { |
| 80 | const opts = getOptions(options) |
| 81 | const inkOptions: InkOptions = { |
| 82 | stdout: process.stdout, |
| 83 | stdin: process.stdin, |
| 84 | stderr: process.stderr, |
| 85 | exitOnCtrlC: true, |
| 86 | patchConsole: true, |
| 87 | ...opts, |
| 88 | } |
| 89 | |
| 90 | const instance: Ink = getInstance( |
| 91 | inkOptions.stdout, |
| 92 | () => new Ink(inkOptions), |
| 93 | ) |
| 94 | |
| 95 | instance.render(node) |
| 96 | |
| 97 | return { |
| 98 | rerender: instance.render, |
| 99 | unmount() { |
| 100 | instance.unmount() |
| 101 | }, |
| 102 | waitUntilExit: instance.waitUntilExit, |
| 103 | cleanup: () => instances.delete(inkOptions.stdout), |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | const wrappedRender = async ( |
| 108 | node: ReactNode, |
no test coverage detected