From 4ed6267ce2d38a50e255b0103aaf02723ba521c9 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Thu, 11 Apr 2024 19:12:29 +0900 Subject: [PATCH] Update dependencies (#643) --- benchmark/static/static.tsx | 4 +- examples/jest/jest.tsx | 18 +- examples/static/static.tsx | 4 +- .../subprocess-output/subprocess-output.tsx | 2 +- examples/suspense/suspense.tsx | 2 +- examples/table/table.tsx | 2 +- .../use-focus-with-id/use-focus-with-id.tsx | 2 +- media/demo.js | 12 +- package.json | 28 +-- src/colorize.ts | 2 +- src/components/App.tsx | 44 ++-- src/components/AppContext.ts | 2 +- src/components/Box.tsx | 6 +- src/components/ErrorOverview.tsx | 2 +- src/components/FocusContext.ts | 2 +- src/components/Static.tsx | 4 +- src/components/StderrContext.ts | 2 +- src/components/StdinContext.ts | 2 +- src/components/StdoutContext.ts | 2 +- src/components/Text.tsx | 2 +- src/devtools-window-polyfill.ts | 16 +- src/dom.ts | 18 +- src/hooks/use-focus-manager.ts | 2 +- src/hooks/use-focus.ts | 4 +- src/hooks/use-input.ts | 2 +- src/ink.tsx | 16 +- src/measure-element.ts | 2 +- src/measure-text.ts | 2 +- src/output.ts | 16 +- src/reconciler.ts | 12 +- src/render-border.ts | 12 +- src/render-node-to-output.ts | 14 +- src/render.ts | 14 +- src/renderer.ts | 10 +- src/styles.ts | 6 +- src/wrap-text.ts | 4 +- test/borders.tsx | 210 +++++++++--------- test/components.tsx | 84 +++---- test/display.tsx | 4 +- test/errors.tsx | 4 +- test/exit.tsx | 8 +- test/fixtures/ci.tsx | 4 +- test/fixtures/exit-on-exit-with-error.tsx | 4 +- test/fixtures/exit-on-exit.tsx | 4 +- test/fixtures/exit-on-finish.tsx | 4 +- test/fixtures/exit-on-unmount.tsx | 4 +- test/flex-align-items.tsx | 12 +- test/flex-align-self.tsx | 12 +- test/flex-direction.tsx | 10 +- test/flex-justify-content.tsx | 24 +- test/flex-wrap.tsx | 12 +- test/flex.tsx | 16 +- test/focus.tsx | 72 +++--- test/gap.tsx | 6 +- test/helpers/render-to-string.ts | 4 +- test/helpers/run.ts | 10 +- test/hooks.tsx | 14 +- test/margin.tsx | 22 +- test/measure-element.tsx | 4 +- test/overflow.tsx | 76 +++---- test/padding.tsx | 22 +- test/reconciler.tsx | 68 +++--- test/render.tsx | 22 +- test/text.tsx | 6 +- test/width-height.tsx | 20 +- 65 files changed, 528 insertions(+), 528 deletions(-) diff --git a/benchmark/static/static.tsx b/benchmark/static/static.tsx index 52310326f..334eaf4e0 100755 --- a/benchmark/static/static.tsx +++ b/benchmark/static/static.tsx @@ -20,8 +20,8 @@ function App() { setItems(previousItems => [ ...previousItems, { - id: previousItems.length - } + id: previousItems.length, + }, ]); timer = setTimeout(run, 10); diff --git a/examples/jest/jest.tsx b/examples/jest/jest.tsx index d1c8dbcbd..b144192cc 100644 --- a/examples/jest/jest.tsx +++ b/examples/jest/jest.tsx @@ -16,7 +16,7 @@ const paths = [ 'tests/delete-profile.js', 'tests/posts.js', 'tests/post.js', - 'tests/comments.js' + 'tests/comments.js', ]; type State = { @@ -38,7 +38,7 @@ class Jest extends React.Component, State> { this.state = { startTime: Date.now(), completedTests: [], - runningTests: [] + runningTests: [], }; } @@ -85,24 +85,24 @@ class Jest extends React.Component, State> { ...previousState.runningTests, { status: 'runs', - path - } - ] + path, + }, + ], })); await delay(1000 * Math.random()); this.setState(previousState => ({ runningTests: previousState.runningTests.filter( - test => test.path !== path + test => test.path !== path, ), completedTests: [ ...previousState.completedTests, { status: Math.random() < 0.5 ? 'pass' : 'fail', - path - } - ] + path, + }, + ], })); } } diff --git a/examples/static/static.tsx b/examples/static/static.tsx index 1063a677f..2ea605516 100644 --- a/examples/static/static.tsx +++ b/examples/static/static.tsx @@ -19,8 +19,8 @@ function Example() { ...previousTests, { id: previousTests.length, - title: `Test #${previousTests.length + 1}` - } + title: `Test #${previousTests.length + 1}`, + }, ]); timer = setTimeout(run, 100); diff --git a/examples/subprocess-output/subprocess-output.tsx b/examples/subprocess-output/subprocess-output.tsx index c7dbad31b..a3874b2d2 100644 --- a/examples/subprocess-output/subprocess-output.tsx +++ b/examples/subprocess-output/subprocess-output.tsx @@ -11,7 +11,7 @@ function SubprocessOutput() { const subProcess = childProcess.spawn('npm', [ 'run', 'example', - 'examples/jest' + 'examples/jest', ]); subProcess.stdout.on('data', (newOutput: Buffer) => { diff --git a/examples/suspense/suspense.tsx b/examples/suspense/suspense.tsx index fa0189608..e4101bae5 100644 --- a/examples/suspense/suspense.tsx +++ b/examples/suspense/suspense.tsx @@ -41,5 +41,5 @@ function Fallback() { render( }> - + , ); diff --git a/examples/table/table.tsx b/examples/table/table.tsx index 0be146002..fa5f48821 100644 --- a/examples/table/table.tsx +++ b/examples/table/table.tsx @@ -7,7 +7,7 @@ const users = Array.from({length: 10}) .map((_, index) => ({ id: index, name: faker.internet.userName(), - email: faker.internet.email() + email: faker.internet.email(), })); function Table() { diff --git a/examples/use-focus-with-id/use-focus-with-id.tsx b/examples/use-focus-with-id/use-focus-with-id.tsx index 91e635584..c9fdf31d2 100644 --- a/examples/use-focus-with-id/use-focus-with-id.tsx +++ b/examples/use-focus-with-id/use-focus-with-id.tsx @@ -5,7 +5,7 @@ import { Text, useFocus, useInput, - useFocusManager + useFocusManager, } from '../../src/index.js'; function Focus() { diff --git a/media/demo.js b/media/demo.js index 0061f239d..51cef1ede 100644 --- a/media/demo.js +++ b/media/demo.js @@ -7,7 +7,7 @@ class Counter extends React.PureComponent { super(); this.state = { - i: 0 + i: 0, }; } @@ -18,20 +18,20 @@ class Counter extends React.PureComponent { React.createElement( Box, {}, - React.createElement(Text, {color: 'blue'}, '~/Projects/ink ') + React.createElement(Text, {color: 'blue'}, '~/Projects/ink '), ), React.createElement( Box, {}, React.createElement(Text, {color: 'magenta'}, '❯ '), React.createElement(Text, {color: 'green'}, 'node '), - React.createElement(Text, {}, 'media/example') + React.createElement(Text, {}, 'media/example'), ), React.createElement( Text, {color: 'green'}, - `${this.state.i} tests passed` - ) + `${this.state.i} tests passed`, + ), ); } @@ -42,7 +42,7 @@ class Counter extends React.PureComponent { } this.setState(previousState => ({ - i: previousState.i + 1 + i: previousState.i + 1, })); }, 100); } diff --git a/package.json b/package.json index 005d63625..a4f45e37c 100644 --- a/package.json +++ b/package.json @@ -62,27 +62,27 @@ "slice-ansi": "^7.1.0", "stack-utils": "^2.0.6", "string-width": "^7.0.0", - "type-fest": "^4.6.0", + "type-fest": "^4.8.3", "widest-line": "^5.0.0", "wrap-ansi": "^9.0.0", - "ws": "^8.12.0", + "ws": "^8.15.0", "yoga-wasm-web": "~0.3.3" }, "devDependencies": { - "@faker-js/faker": "^8.2.0", + "@faker-js/faker": "^8.3.1", "@sindresorhus/tsconfig": "^5.0.0", "@types/benchmark": "^2.1.2", - "@types/lodash": "^4.14.191", + "@types/lodash": "^4.14.202", "@types/ms": "^0.7.31", - "@types/node": "*", - "@types/react": "^18.0.0", + "@types/node": "^20.10.4", + "@types/react": "^18.2.43", "@types/react-reconciler": "^0.28.2", - "@types/scheduler": "^0.16.2", + "@types/scheduler": "^0.16.8", "@types/signal-exit": "^3.0.0", "@types/sinon": "^10.0.20", "@types/stack-utils": "^2.0.2", - "@types/ws": "^8.5.4", - "@vdemedes/prettier-config": "^1.0.1", + "@types/ws": "^8.5.10", + "@vdemedes/prettier-config": "^2.0.1", "ava": "^5.1.1", "boxen": "^7.0.1", "delay": "^6.0.0", @@ -91,14 +91,14 @@ "eslint-plugin-react-hooks": "4.6.0", "ms": "^2.1.3", "node-pty": "^1.0.0", - "p-queue": "^7.3.4", - "prettier": "^2.0.4", + "p-queue": "^8.0.0", + "prettier": "^3.1.1", "react": "^18.0.0", - "react-devtools-core": "^4.19.1", + "react-devtools-core": "^5.0.0", "sinon": "^17.0.0", "strip-ansi": "^7.1.0", - "ts-node": "10.9.1", - "typescript": "^5.2.2", + "ts-node": "^10.9.2", + "typescript": "^5.3.3", "xo": "^0.56.0" }, "peerDependencies": { diff --git a/src/colorize.ts b/src/colorize.ts index 1a2562eb3..29faa581e 100644 --- a/src/colorize.ts +++ b/src/colorize.ts @@ -12,7 +12,7 @@ const isNamedColor = (color: string): color is ForegroundColorName => { const colorize = ( str: string, color: string | undefined, - type: ColorType + type: ColorType, ): string => { if (!color) { return str; diff --git a/src/components/App.tsx b/src/components/App.tsx index f65181604..462479454 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -50,7 +50,7 @@ export default class App extends PureComponent { isFocusEnabled: true, activeFocusId: undefined, focusables: [], - error: undefined + error: undefined, }; // Count how many components enabled raw mode to avoid disabling @@ -69,7 +69,7 @@ export default class App extends PureComponent { { // eslint-disable-next-line @typescript-eslint/naming-convention internal_exitOnCtrlC: this.props.exitOnCtrlC, // eslint-disable-next-line @typescript-eslint/naming-convention - internal_eventEmitter: this.internal_eventEmitter + internal_eventEmitter: this.internal_eventEmitter, }} > { disableFocus: this.disableFocus, focusNext: this.focusNext, focusPrevious: this.focusPrevious, - focus: this.focus + focus: this.focus, }} > {this.state.error ? ( @@ -149,11 +149,11 @@ export default class App extends PureComponent { if (!this.isRawModeSupported()) { if (stdin === process.stdin) { throw new Error( - 'Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported' + 'Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported', ); } else { throw new Error( - 'Raw mode is not supported on the stdin provided to Ink.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported' + 'Raw mode is not supported on the stdin provided to Ink.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported', ); } } @@ -199,7 +199,7 @@ export default class App extends PureComponent { // Reset focus when there's an active focused component on Esc if (input === escape && this.state.activeFocusId) { this.setState({ - activeFocusId: undefined + activeFocusId: undefined, }); } @@ -224,20 +224,20 @@ export default class App extends PureComponent { enableFocus = (): void => { this.setState({ - isFocusEnabled: true + isFocusEnabled: true, }); }; disableFocus = (): void => { this.setState({ - isFocusEnabled: false + isFocusEnabled: false, }); }; focus = (id: string): void => { this.setState(previousState => { const hasFocusableId = previousState.focusables.some( - focusable => focusable?.id === id + focusable => focusable?.id === id, ); if (!hasFocusableId) { @@ -254,7 +254,7 @@ export default class App extends PureComponent { const nextFocusableId = this.findNextFocusable(previousState); return { - activeFocusId: nextFocusableId ?? firstFocusableId + activeFocusId: nextFocusableId ?? firstFocusableId, }; }); }; @@ -266,7 +266,7 @@ export default class App extends PureComponent { const previousFocusableId = this.findPreviousFocusable(previousState); return { - activeFocusId: previousFocusableId ?? lastFocusableId + activeFocusId: previousFocusableId ?? lastFocusableId, }; }); }; @@ -285,9 +285,9 @@ export default class App extends PureComponent { ...previousState.focusables, { id, - isActive: true - } - ] + isActive: true, + }, + ], }; }); }; @@ -300,7 +300,7 @@ export default class App extends PureComponent { : previousState.activeFocusId, focusables: previousState.focusables.filter(focusable => { return focusable.id !== id; - }) + }), })); }; @@ -313,9 +313,9 @@ export default class App extends PureComponent { return { id, - isActive: true + isActive: true, }; - }) + }), })); }; @@ -332,9 +332,9 @@ export default class App extends PureComponent { return { id, - isActive: false + isActive: false, }; - }) + }), })); }; diff --git a/src/components/AppContext.ts b/src/components/AppContext.ts index b7f3b94ea..2c7e546a1 100644 --- a/src/components/AppContext.ts +++ b/src/components/AppContext.ts @@ -12,7 +12,7 @@ export type Props = { */ // eslint-disable-next-line @typescript-eslint/naming-convention const AppContext = createContext({ - exit() {} + exit() {}, }); AppContext.displayName = 'InternalAppContext'; diff --git a/src/components/Box.tsx b/src/components/Box.tsx index b44a48c53..530206d8d 100644 --- a/src/components/Box.tsx +++ b/src/components/Box.tsx @@ -16,13 +16,13 @@ const Box = forwardRef>( style={{ ...style, overflowX: style.overflowX ?? style.overflow ?? 'visible', - overflowY: style.overflowY ?? style.overflow ?? 'visible' + overflowY: style.overflowY ?? style.overflow ?? 'visible', }} > {children} ); - } + }, ); Box.displayName = 'Box'; @@ -31,7 +31,7 @@ Box.defaultProps = { flexWrap: 'nowrap', flexDirection: 'row', flexGrow: 0, - flexShrink: 1 + flexShrink: 1, }; export default Box; diff --git a/src/components/ErrorOverview.tsx b/src/components/ErrorOverview.tsx index b1f314170..adfdf615d 100644 --- a/src/components/ErrorOverview.tsx +++ b/src/components/ErrorOverview.tsx @@ -14,7 +14,7 @@ const cleanupPath = (path: string | undefined): string | undefined => { const stackUtils = new StackUtils({ cwd: cwd(), - internals: StackUtils.nodeInternals() + internals: StackUtils.nodeInternals(), }); type Props = { diff --git a/src/components/FocusContext.ts b/src/components/FocusContext.ts index f8f50cc58..a16240205 100644 --- a/src/components/FocusContext.ts +++ b/src/components/FocusContext.ts @@ -24,7 +24,7 @@ const FocusContext = createContext({ disableFocus() {}, focusNext() {}, focusPrevious() {}, - focus() {} + focus() {}, }); FocusContext.displayName = 'InternalFocusContext'; diff --git a/src/components/Static.tsx b/src/components/Static.tsx index 54c934a22..f0d800d68 100644 --- a/src/components/Static.tsx +++ b/src/components/Static.tsx @@ -52,9 +52,9 @@ export default function Static(props: Props) { () => ({ position: 'absolute', flexDirection: 'column', - ...customStyle + ...customStyle, }), - [customStyle] + [customStyle], ); return ( diff --git a/src/components/StderrContext.ts b/src/components/StderrContext.ts index 63997834e..c86c8d456 100644 --- a/src/components/StderrContext.ts +++ b/src/components/StderrContext.ts @@ -21,7 +21,7 @@ export type Props = { // eslint-disable-next-line @typescript-eslint/naming-convention const StderrContext = createContext({ stderr: process.stderr, - write() {} + write() {}, }); StderrContext.displayName = 'InternalStderrContext'; diff --git a/src/components/StdinContext.ts b/src/components/StdinContext.ts index 2f32a1c2f..5468ffef8 100644 --- a/src/components/StdinContext.ts +++ b/src/components/StdinContext.ts @@ -35,7 +35,7 @@ const StdinContext = createContext({ setRawMode() {}, isRawModeSupported: false, // eslint-disable-next-line @typescript-eslint/naming-convention - internal_exitOnCtrlC: true + internal_exitOnCtrlC: true, }); StdinContext.displayName = 'InternalStdinContext'; diff --git a/src/components/StdoutContext.ts b/src/components/StdoutContext.ts index 8c155b324..232c19937 100644 --- a/src/components/StdoutContext.ts +++ b/src/components/StdoutContext.ts @@ -21,7 +21,7 @@ export type Props = { // eslint-disable-next-line @typescript-eslint/naming-convention const StdoutContext = createContext({ stdout: process.stdout, - write() {} + write() {}, }); StdoutContext.displayName = 'InternalStdoutContext'; diff --git a/src/components/Text.tsx b/src/components/Text.tsx index 4929a31dc..826e02c0d 100644 --- a/src/components/Text.tsx +++ b/src/components/Text.tsx @@ -68,7 +68,7 @@ export default function Text({ strikethrough = false, inverse = false, wrap = 'wrap', - children + children, }: Props) { if (children === undefined || children === null) { return null; diff --git a/src/devtools-window-polyfill.ts b/src/devtools-window-polyfill.ts index 1f5db18f8..50f486b4b 100644 --- a/src/devtools-window-polyfill.ts +++ b/src/devtools-window-polyfill.ts @@ -27,48 +27,48 @@ customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [ type: 1, // ElementTypeHostComponent value: 7, - isEnabled: true + isEnabled: true, }, { // ComponentFilterDisplayName type: 2, value: 'InternalApp', isEnabled: true, - isValid: true + isValid: true, }, { // ComponentFilterDisplayName type: 2, value: 'InternalAppContext', isEnabled: true, - isValid: true + isValid: true, }, { // ComponentFilterDisplayName type: 2, value: 'InternalStdoutContext', isEnabled: true, - isValid: true + isValid: true, }, { // ComponentFilterDisplayName type: 2, value: 'InternalStderrContext', isEnabled: true, - isValid: true + isValid: true, }, { // ComponentFilterDisplayName type: 2, value: 'InternalStdinContext', isEnabled: true, - isValid: true + isValid: true, }, { // ComponentFilterDisplayName type: 2, value: 'InternalFocusContext', isEnabled: true, - isValid: true - } + isValid: true, + }, ]; diff --git a/src/dom.ts b/src/dom.ts index 451d56d11..94c76317c 100644 --- a/src/dom.ts +++ b/src/dom.ts @@ -60,7 +60,7 @@ export const createNode = (nodeName: ElementNames): DOMElement => { attributes: {}, childNodes: [], parentNode: undefined, - yogaNode: nodeName === 'ink-virtual-text' ? undefined : Yoga.Node.create() + yogaNode: nodeName === 'ink-virtual-text' ? undefined : Yoga.Node.create(), }; if (nodeName === 'ink-text') { @@ -72,7 +72,7 @@ export const createNode = (nodeName: ElementNames): DOMElement => { export const appendChildNode = ( node: DOMElement, - childNode: DOMElement + childNode: DOMElement, ): void => { if (childNode.parentNode) { removeChildNode(childNode.parentNode, childNode); @@ -84,7 +84,7 @@ export const appendChildNode = ( if (childNode.yogaNode) { node.yogaNode?.insertChild( childNode.yogaNode, - node.yogaNode.getChildCount() + node.yogaNode.getChildCount(), ); } @@ -96,7 +96,7 @@ export const appendChildNode = ( export const insertBeforeNode = ( node: DOMElement, newChildNode: DOMNode, - beforeChildNode: DOMNode + beforeChildNode: DOMNode, ): void => { if (newChildNode.parentNode) { removeChildNode(newChildNode.parentNode, newChildNode); @@ -119,7 +119,7 @@ export const insertBeforeNode = ( if (newChildNode.yogaNode) { node.yogaNode?.insertChild( newChildNode.yogaNode, - node.yogaNode.getChildCount() + node.yogaNode.getChildCount(), ); } @@ -130,7 +130,7 @@ export const insertBeforeNode = ( export const removeChildNode = ( node: DOMElement, - removeNode: DOMNode + removeNode: DOMNode, ): void => { if (removeNode.yogaNode) { removeNode.parentNode?.yogaNode?.removeChild(removeNode.yogaNode); @@ -151,7 +151,7 @@ export const removeChildNode = ( export const setAttribute = ( node: DOMElement, key: string, - value: DOMNodeAttribute + value: DOMNodeAttribute, ): void => { node.attributes[key] = value; }; @@ -166,7 +166,7 @@ export const createTextNode = (text: string): TextNode => { nodeValue: text, yogaNode: undefined, parentNode: undefined, - style: {} + style: {}, }; setTextNodeValue(node, text); @@ -176,7 +176,7 @@ export const createTextNode = (text: string): TextNode => { const measureTextNode = function ( node: DOMNode, - width: number + width: number, ): {width: number; height: number} { const text = node.nodeName === '#text' ? node.nodeValue : squashTextNodes(node); diff --git a/src/hooks/use-focus-manager.ts b/src/hooks/use-focus-manager.ts index 3b379642c..329da9181 100644 --- a/src/hooks/use-focus-manager.ts +++ b/src/hooks/use-focus-manager.ts @@ -45,7 +45,7 @@ const useFocusManager = (): Output => { disableFocus: focusContext.disableFocus, focusNext: focusContext.focusNext, focusPrevious: focusContext.focusPrevious, - focus: focusContext.focus + focus: focusContext.focus, }; }; diff --git a/src/hooks/use-focus.ts b/src/hooks/use-focus.ts index 931d253f2..c4b2ffb25 100644 --- a/src/hooks/use-focus.ts +++ b/src/hooks/use-focus.ts @@ -42,7 +42,7 @@ type Output = { const useFocus = ({ isActive = true, autoFocus = false, - id: customId + id: customId, }: Input = {}): Output => { const {isRawModeSupported, setRawMode} = useStdin(); const {activeId, add, remove, activate, deactivate, focus} = @@ -82,7 +82,7 @@ const useFocus = ({ return { isFocused: Boolean(id) && activeId === id, - focus + focus, }; }; diff --git a/src/hooks/use-input.ts b/src/hooks/use-input.ts index 2bb05cabf..a636d688b 100644 --- a/src/hooks/use-input.ts +++ b/src/hooks/use-input.ts @@ -157,7 +157,7 @@ const useInput = (inputHandler: Handler, options: Options = {}) => { // but with option = true, so we need to take this into account here // to avoid breaking changes in Ink. // TODO(vadimdemedes): consider removing this in the next major version. - meta: keypress.meta || keypress.name === 'escape' || keypress.option + meta: keypress.meta || keypress.name === 'escape' || keypress.option, }; let input = keypress.ctrl ? keypress.name : keypress.sequence; diff --git a/src/ink.tsx b/src/ink.tsx index e5efac2df..223c82fa4 100644 --- a/src/ink.tsx +++ b/src/ink.tsx @@ -55,8 +55,8 @@ export default class Ink { ? this.onRender : throttle(this.onRender, 32, { leading: true, - trailing: true - }); + trailing: true, + }); this.rootNode.onImmediateRender = this.onRender; this.log = logUpdate.create(options.stdout); @@ -64,8 +64,8 @@ export default class Ink { ? this.log : throttle(this.log, undefined, { leading: true, - trailing: true - }); + trailing: true, + }); // Ignore last render after unmounting a tree to prevent empty output before exit this.isUnmounted = false; @@ -87,7 +87,7 @@ export default class Ink { null, 'id', () => {}, - null + null, ); // Unmount when process exits @@ -99,7 +99,7 @@ export default class Ink { // Reporting React DOM's version, not Ink's // See https://github.com/facebook/react/issues/16666#issuecomment-532639905 version: '16.13.1', - rendererPackageName: 'ink' + rendererPackageName: 'ink', }); } @@ -135,7 +135,7 @@ export default class Ink { this.rootNode.yogaNode!.calculateLayout( undefined, undefined, - Yoga.DIRECTION_LTR + Yoga.DIRECTION_LTR, ); }; @@ -173,7 +173,7 @@ export default class Ink { if (outputHeight >= this.options.stdout.rows) { this.options.stdout.write( - ansiEscapes.clearTerminal + this.fullStaticOutput + output + ansiEscapes.clearTerminal + this.fullStaticOutput + output, ); this.lastOutput = output; return; diff --git a/src/measure-element.ts b/src/measure-element.ts index aa26331ca..af4ca796b 100644 --- a/src/measure-element.ts +++ b/src/measure-element.ts @@ -17,7 +17,7 @@ type Output = { */ const measureElement = (node: DOMElement): Output => ({ width: node.yogaNode?.getComputedWidth() ?? 0, - height: node.yogaNode?.getComputedHeight() ?? 0 + height: node.yogaNode?.getComputedHeight() ?? 0, }); export default measureElement; diff --git a/src/measure-text.ts b/src/measure-text.ts index 2e7628580..7f546055e 100644 --- a/src/measure-text.ts +++ b/src/measure-text.ts @@ -11,7 +11,7 @@ const measureText = (text: string): Output => { if (text.length === 0) { return { width: 0, - height: 0 + height: 0, }; } diff --git a/src/output.ts b/src/output.ts index 09e500e8c..7c9eeb8fa 100644 --- a/src/output.ts +++ b/src/output.ts @@ -5,7 +5,7 @@ import { type StyledChar, styledCharsFromTokens, styledCharsToString, - tokenize + tokenize, } from '@alcalzone/ansi-tokenize'; import {type OutputTransformer} from './render-node-to-output.js'; @@ -66,7 +66,7 @@ export default class Output { x: number, y: number, text: string, - options: {transformers: OutputTransformer[]} + options: {transformers: OutputTransformer[]}, ): void { const {transformers} = options; @@ -79,20 +79,20 @@ export default class Output { x, y, text, - transformers + transformers, }); } clip(clip: Clip) { this.operations.push({ type: 'clip', - clip + clip, }); } unclip() { this.operations.push({ - type: 'unclip' + type: 'unclip', }); } @@ -108,7 +108,7 @@ export default class Output { type: 'char', value: ' ', fullWidth: false, - styles: [] + styles: [], }); } @@ -215,7 +215,7 @@ export default class Output { type: 'char', value: '', fullWidth: false, - styles: character.styles + styles: character.styles, }; } @@ -238,7 +238,7 @@ export default class Output { return { output: generatedOutput, - height: output.length + height: output.length, }; } } diff --git a/src/reconciler.ts b/src/reconciler.ts index d0bdad294..1738f737b 100644 --- a/src/reconciler.ts +++ b/src/reconciler.ts @@ -14,7 +14,7 @@ import { type DOMNodeAttribute, type TextNode, type ElementNames, - type DOMElement + type DOMElement, } from './dom.js'; import applyStyles, {type Styles} from './styles.js'; import {type OutputTransformer} from './render-node-to-output.js'; @@ -32,7 +32,7 @@ if (process.env['DEV'] === 'true') { Debugging with React Devtools requires \`react-devtools-core\` dependency to be installed. $ npm install --save-dev react-devtools-core - `.trim() + '\n' + `.trim() + '\n', ); } else { // eslint-disable-next-line @typescript-eslint/no-throw-literal @@ -108,7 +108,7 @@ export default createReconciler< unknown >({ getRootHostContext: () => ({ - isInsideText: false + isInsideText: false, }), prepareForCommit: () => null, preparePortalMount: () => null, @@ -190,7 +190,7 @@ export default createReconciler< createTextInstance(text, _root, hostContext) { if (!hostContext.isInsideText) { throw new Error( - `Text string "${text}" must be rendered inside component` + `Text string "${text}" must be rendered inside component`, ); } @@ -253,7 +253,7 @@ export default createReconciler< const style = diff( oldProps['style'] as Styles, - newProps['style'] as Styles + newProps['style'] as Styles, ); if (!props && !style) { @@ -294,5 +294,5 @@ export default createReconciler< removeChild(node, removeNode) { removeChildNode(node, removeNode); cleanupYogaNode(removeNode.yogaNode); - } + }, }); diff --git a/src/render-border.ts b/src/render-border.ts index e04e0d488..60b50f3e0 100644 --- a/src/render-border.ts +++ b/src/render-border.ts @@ -8,7 +8,7 @@ const renderBorder = ( x: number, y: number, node: DOMNode, - output: Output + output: Output, ): void => { if (node.style.borderStyle) { const width = node.yogaNode!.getComputedWidth(); @@ -52,8 +52,8 @@ const renderBorder = ( box.top.repeat(contentWidth) + (showRightBorder ? box.topRight : ''), topBorderColor, - 'foreground' - ) + 'foreground', + ) : undefined; if (showTopBorder && dimTopBorderColor) { @@ -92,8 +92,8 @@ const renderBorder = ( box.bottom.repeat(contentWidth) + (showRightBorder ? box.bottomRight : ''), bottomBorderColor, - 'foreground' - ) + 'foreground', + ) : undefined; if (showBottomBorder && dimBottomBorderColor) { @@ -112,7 +112,7 @@ const renderBorder = ( if (showRightBorder) { output.write(x + width - 1, y + offsetY, rightBorder, { - transformers: [] + transformers: [], }); } diff --git a/src/render-node-to-output.ts b/src/render-node-to-output.ts index 50bf2cd12..965f90e2a 100644 --- a/src/render-node-to-output.ts +++ b/src/render-node-to-output.ts @@ -37,13 +37,13 @@ const renderNodeToOutput = ( offsetY?: number; transformers?: OutputTransformer[]; skipStaticElements: boolean; - } + }, ) => { const { offsetX = 0, offsetY = 0, transformers = [], - skipStaticElements + skipStaticElements, } = options; if (skipStaticElements && node.internal_static) { @@ -106,8 +106,8 @@ const renderNodeToOutput = ( const x2 = clipHorizontally ? x + - yogaNode.getComputedWidth() - - yogaNode.getComputedBorder(Yoga.EDGE_RIGHT) + yogaNode.getComputedWidth() - + yogaNode.getComputedBorder(Yoga.EDGE_RIGHT) : undefined; const y1 = clipVertically @@ -116,8 +116,8 @@ const renderNodeToOutput = ( const y2 = clipVertically ? y + - yogaNode.getComputedHeight() - - yogaNode.getComputedBorder(Yoga.EDGE_BOTTOM) + yogaNode.getComputedHeight() - + yogaNode.getComputedBorder(Yoga.EDGE_BOTTOM) : undefined; output.clip({x1, x2, y1, y2}); @@ -131,7 +131,7 @@ const renderNodeToOutput = ( offsetX: x, offsetY: y, transformers: newTransformers, - skipStaticElements + skipStaticElements, }); } diff --git a/src/render.ts b/src/render.ts index 60e66fdba..7893f211e 100644 --- a/src/render.ts +++ b/src/render.ts @@ -69,7 +69,7 @@ export type Instance = { */ const render = ( node: ReactNode, - options?: NodeJS.WriteStream | RenderOptions + options?: NodeJS.WriteStream | RenderOptions, ): Instance => { const inkOptions: InkOptions = { stdout: process.stdout, @@ -78,12 +78,12 @@ const render = ( debug: false, exitOnCtrlC: true, patchConsole: true, - ...getOptions(options) + ...getOptions(options), }; const instance: Ink = getInstance( inkOptions.stdout, - () => new Ink(inkOptions) + () => new Ink(inkOptions), ); instance.render(node); @@ -95,19 +95,19 @@ const render = ( }, waitUntilExit: instance.waitUntilExit, cleanup: () => instances.delete(inkOptions.stdout), - clear: instance.clear + clear: instance.clear, }; }; export default render; const getOptions = ( - stdout: NodeJS.WriteStream | RenderOptions | undefined = {} + stdout: NodeJS.WriteStream | RenderOptions | undefined = {}, ): RenderOptions => { if (stdout instanceof Stream) { return { stdout, - stdin: process.stdin + stdin: process.stdin, }; } @@ -116,7 +116,7 @@ const getOptions = ( const getInstance = ( stdout: NodeJS.WriteStream, - createInstance: () => Ink + createInstance: () => Ink, ): Ink => { let instance = instances.get(stdout); diff --git a/src/renderer.ts b/src/renderer.ts index a112332c1..4898a7b60 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -12,7 +12,7 @@ const renderer = (node: DOMElement): Result => { if (node.yogaNode) { const output = new Output({ width: node.yogaNode.getComputedWidth(), - height: node.yogaNode.getComputedHeight() + height: node.yogaNode.getComputedHeight(), }); renderNodeToOutput(node, output, {skipStaticElements: true}); @@ -22,11 +22,11 @@ const renderer = (node: DOMElement): Result => { if (node.staticNode?.yogaNode) { staticOutput = new Output({ width: node.staticNode.yogaNode.getComputedWidth(), - height: node.staticNode.yogaNode.getComputedHeight() + height: node.staticNode.yogaNode.getComputedHeight(), }); renderNodeToOutput(node.staticNode, staticOutput, { - skipStaticElements: false + skipStaticElements: false, }); } @@ -37,14 +37,14 @@ const renderer = (node: DOMElement): Result => { outputHeight, // Newline at the end is needed, because static output doesn't have one, so // interactive output will override last line of static output - staticOutput: staticOutput ? `${staticOutput.get().output}\n` : '' + staticOutput: staticOutput ? `${staticOutput.get().output}\n` : '', }; } return { output: '', outputHeight: 0, - staticOutput: '' + staticOutput: '', }; }; diff --git a/src/styles.ts b/src/styles.ts index 7e6cb2150..f465299a1 100644 --- a/src/styles.ts +++ b/src/styles.ts @@ -308,7 +308,7 @@ const applyPositionStyles = (node: YogaNode, style: Styles): void => { node.setPositionType( style.position === 'absolute' ? Yoga.POSITION_TYPE_ABSOLUTE - : Yoga.POSITION_TYPE_RELATIVE + : Yoga.POSITION_TYPE_RELATIVE, ); } }; @@ -380,7 +380,7 @@ const applyFlexStyles = (node: YogaNode, style: Styles): void => { if ('flexShrink' in style) { node.setFlexShrink( - typeof style.flexShrink === 'number' ? style.flexShrink : 1 + typeof style.flexShrink === 'number' ? style.flexShrink : 1, ); } @@ -527,7 +527,7 @@ const applyDimensionStyles = (node: YogaNode, style: Styles): void => { const applyDisplayStyles = (node: YogaNode, style: Styles): void => { if ('display' in style) { node.setDisplay( - style.display === 'flex' ? Yoga.DISPLAY_FLEX : Yoga.DISPLAY_NONE + style.display === 'flex' ? Yoga.DISPLAY_FLEX : Yoga.DISPLAY_NONE, ); } }; diff --git a/src/wrap-text.ts b/src/wrap-text.ts index 64d254a26..1349e5e14 100644 --- a/src/wrap-text.ts +++ b/src/wrap-text.ts @@ -7,7 +7,7 @@ const cache: Record = {}; const wrapText = ( text: string, maxWidth: number, - wrapType: Styles['textWrap'] + wrapType: Styles['textWrap'], ): string => { const cacheKey = text + String(maxWidth) + String(wrapType); const cachedText = cache[cacheKey]; @@ -21,7 +21,7 @@ const wrapText = ( if (wrapType === 'wrap') { wrappedText = wrapAnsi(text, maxWidth, { trim: false, - hard: true + hard: true, }); } diff --git a/test/borders.tsx b/test/borders.tsx index 663f330c5..10a00ecf3 100644 --- a/test/borders.tsx +++ b/test/borders.tsx @@ -14,7 +14,7 @@ test('single node - full width box', t => { const output = renderToString( Hello World - + , ); t.is(output, boxen('Hello World', {width: 100, borderStyle: 'round'})); @@ -24,7 +24,7 @@ test('single node - full width box with colorful border', t => { const output = renderToString( Hello World - + , ); t.is( @@ -32,8 +32,8 @@ test('single node - full width box with colorful border', t => { boxen('Hello World', { width: 100, borderStyle: 'round', - borderColor: 'green' - }) + borderColor: 'green', + }), ); }); @@ -41,7 +41,7 @@ test('single node - fit-content box', t => { const output = renderToString( Hello World - + , ); t.is(output, boxen('Hello World', {borderStyle: 'round'})); @@ -51,7 +51,7 @@ test('single node - fit-content box with wide characters', t => { const output = renderToString( こんにちは - + , ); t.is(output, boxen('こんにちは', {borderStyle: 'round'})); @@ -61,7 +61,7 @@ test('single node - fit-content box with emojis', t => { const output = renderToString( 🌊🌊 - + , ); t.is(output, boxen('🌊🌊', {borderStyle: 'round'})); @@ -71,7 +71,7 @@ test('single node - fixed width box', t => { const output = renderToString( Hello World - + , ); t.is(output, boxen('Hello World'.padEnd(18, ' '), {borderStyle: 'round'})); @@ -81,14 +81,14 @@ test('single node - fixed width and height box', t => { const output = renderToString( Hello World - + , ); t.is( output, boxen('Hello World'.padEnd(18, ' ') + '\n'.repeat(17), { - borderStyle: 'round' - }) + borderStyle: 'round', + }), ); }); @@ -96,7 +96,7 @@ test('single node - box with padding', t => { const output = renderToString( Hello World - + , ); t.is(output, boxen('\n Hello World \n', {borderStyle: 'round'})); @@ -106,7 +106,7 @@ test('single node - box with horizontal alignment', t => { const output = renderToString( Hello World - + , ); t.is(output, boxen(' Hello World ', {borderStyle: 'round'})); @@ -121,14 +121,14 @@ test('single node - box with vertical alignment', t => { alignSelf="flex-start" > Hello World - + , ); t.is( output, boxen('\n'.repeat(8) + 'Hello World' + '\n'.repeat(9), { - borderStyle: 'round' - }) + borderStyle: 'round', + }), ); }); @@ -136,7 +136,7 @@ test('single node - box with wrapping', t => { const output = renderToString( Hello World - + , ); t.is(output, boxen('Hello \nWorld', {borderStyle: 'round'})); @@ -146,7 +146,7 @@ test('multiple nodes - full width box', t => { const output = renderToString( {'Hello '}World - + , ); t.is(output, boxen('Hello World', {width: 100, borderStyle: 'round'})); @@ -156,7 +156,7 @@ test('multiple nodes - full width box with colorful border', t => { const output = renderToString( {'Hello '}World - + , ); t.is( @@ -164,8 +164,8 @@ test('multiple nodes - full width box with colorful border', t => { boxen('Hello World', { width: 100, borderStyle: 'round', - borderColor: 'green' - }) + borderColor: 'green', + }), ); }); @@ -173,7 +173,7 @@ test('multiple nodes - fit-content box', t => { const output = renderToString( {'Hello '}World - + , ); t.is(output, boxen('Hello World', {borderStyle: 'round'})); @@ -183,7 +183,7 @@ test('multiple nodes - fixed width box', t => { const output = renderToString( {'Hello '}World - + , ); t.is(output, boxen('Hello World'.padEnd(18, ' '), {borderStyle: 'round'})); }); @@ -192,13 +192,13 @@ test('multiple nodes - fixed width and height box', t => { const output = renderToString( {'Hello '}World - + , ); t.is( output, boxen('Hello World'.padEnd(18, ' ') + '\n'.repeat(17), { - borderStyle: 'round' - }) + borderStyle: 'round', + }), ); }); @@ -206,7 +206,7 @@ test('multiple nodes - box with padding', t => { const output = renderToString( {'Hello '}World - + , ); t.is(output, boxen('\n Hello World \n', {borderStyle: 'round'})); @@ -216,7 +216,7 @@ test('multiple nodes - box with horizontal alignment', t => { const output = renderToString( {'Hello '}World - + , ); t.is(output, boxen(' Hello World ', {borderStyle: 'round'})); @@ -231,14 +231,14 @@ test('multiple nodes - box with vertical alignment', t => { alignSelf="flex-start" > {'Hello '}World - + , ); t.is( output, boxen('\n'.repeat(8) + 'Hello World' + '\n'.repeat(9), { - borderStyle: 'round' - }) + borderStyle: 'round', + }), ); }); @@ -246,7 +246,7 @@ test('multiple nodes - box with wrapping', t => { const output = renderToString( {'Hello '}World - + , ); t.is(output, boxen('Hello \nWorld', {borderStyle: 'round'})); @@ -256,7 +256,7 @@ test('multiple nodes - box with wrapping and long first node', t => { const output = renderToString( {'Helloooooo'} World - + , ); t.is(output, boxen('Helloooo\noo World', {borderStyle: 'round'})); @@ -266,7 +266,7 @@ test('multiple nodes - box with wrapping and very long first node', t => { const output = renderToString( {'Hellooooooooooooo'} World - + , ); t.is(output, boxen('Helloooo\noooooooo\no World', {borderStyle: 'round'})); @@ -278,17 +278,17 @@ test('nested boxes', t => { Hello World - + , ); const nestedBox = indentString( boxen('\n Hello World \n', {borderStyle: 'round'}), - 1 + 1, ); t.is( output, - boxen(`${' '.repeat(38)}\n${nestedBox}\n`, {borderStyle: 'round'}) + boxen(`${' '.repeat(38)}\n${nestedBox}\n`, {borderStyle: 'round'}), ); }); @@ -304,7 +304,7 @@ test('nested boxes - fit-content box with wide characters on flex-direction row' カーク船長 - + , ); const box1 = boxen('ミスター', {borderStyle: 'round'}); @@ -316,10 +316,10 @@ test('nested boxes - fit-content box with wide characters on flex-direction row' .split('\n') .map( (line, index) => - line + box2.split('\n')[index]! + box3.split('\n')[index]! + line + box2.split('\n')[index]! + box3.split('\n')[index]!, ) .join('\n'), - {borderStyle: 'round'} + {borderStyle: 'round'}, ); t.is(output, expected); @@ -337,7 +337,7 @@ test('nested boxes - fit-content box with emojis on flex-direction row', t => { 😋 - + , ); const box1 = boxen('🦾', {borderStyle: 'round'}); @@ -349,10 +349,10 @@ test('nested boxes - fit-content box with emojis on flex-direction row', t => { .split('\n') .map( (line, index) => - line + box2.split('\n')[index]! + box3.split('\n')[index]! + line + box2.split('\n')[index]! + box3.split('\n')[index]!, ) .join('\n'), - {borderStyle: 'round'} + {borderStyle: 'round'}, ); t.is(output, expected); @@ -370,7 +370,7 @@ test('nested boxes - fit-content box with wide characters on flex-direction colu カーク船長 - + , ); const expected = boxen( @@ -379,7 +379,7 @@ test('nested boxes - fit-content box with wide characters on flex-direction colu boxen('スポック ', {borderStyle: 'round'}) + '\n' + boxen('カーク船長', {borderStyle: 'round'}), - {borderStyle: 'round'} + {borderStyle: 'round'}, ); t.is(output, expected); @@ -397,7 +397,7 @@ test('nested boxes - fit-content box with emojis on flex-direction column', t => 😋 - + , ); const expected = boxen( @@ -406,7 +406,7 @@ test('nested boxes - fit-content box with emojis on flex-direction column', t => boxen('🌏', {borderStyle: 'round'}) + '\n' + boxen('😋', {borderStyle: 'round'}), - {borderStyle: 'round'} + {borderStyle: 'round'}, ); t.is(output, expected); @@ -425,12 +425,12 @@ test('render border after update', t => { const {rerender} = render(, { stdout, - debug: true + debug: true, }); t.is( (stdout.write as any).lastCall.args[0], - boxen('Hello World', {width: 100, borderStyle: 'round'}) + boxen('Hello World', {width: 100, borderStyle: 'round'}), ); rerender(); @@ -440,8 +440,8 @@ test('render border after update', t => { boxen('Hello World', { width: 100, borderStyle: 'round', - borderColor: 'green' - }) + borderColor: 'green', + }), ); rerender(); @@ -450,8 +450,8 @@ test('render border after update', t => { (stdout.write as any).lastCall.args[0], boxen('Hello World', { width: 100, - borderStyle: 'round' - }) + borderStyle: 'round', + }), ); }); @@ -463,7 +463,7 @@ test('hide top border', t => { Content Below - + , ); t.is( @@ -474,8 +474,8 @@ test('hide top border', t => { `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight }`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -487,7 +487,7 @@ test('hide bottom border', t => { Content Below - + , ); t.is( @@ -498,8 +498,8 @@ test('hide bottom border', t => { cliBoxes.round.topRight }`, `${cliBoxes.round.left}Content${cliBoxes.round.right}`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -511,7 +511,7 @@ test('hide top and bottom borders', t => { Content Below - + , ); t.is( @@ -519,8 +519,8 @@ test('hide top and bottom borders', t => { [ 'Above', `${cliBoxes.round.left}Content${cliBoxes.round.right}`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -532,7 +532,7 @@ test('hide left border', t => { Content Below - + , ); t.is( @@ -542,8 +542,8 @@ test('hide left border', t => { `${cliBoxes.round.top.repeat(7)}${cliBoxes.round.topRight}`, `Content${cliBoxes.round.right}`, `${cliBoxes.round.bottom.repeat(7)}${cliBoxes.round.bottomRight}`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -555,7 +555,7 @@ test('hide right border', t => { Content Below - + , ); t.is( @@ -565,8 +565,8 @@ test('hide right border', t => { `${cliBoxes.round.topLeft}${cliBoxes.round.top.repeat(7)}`, `${cliBoxes.round.left}Content`, `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -578,7 +578,7 @@ test('hide left and right border', t => { Content Below - + , ); t.is( @@ -588,8 +588,8 @@ test('hide left and right border', t => { cliBoxes.round.top.repeat(7), 'Content', cliBoxes.round.bottom.repeat(7), - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -607,7 +607,7 @@ test('hide all borders', t => { Content Below - + , ); t.is(output, ['Above', 'Content', 'Below'].join('\n')); @@ -621,7 +621,7 @@ test('change color of top border', t => { Content Below - + , ); t.is( @@ -631,14 +631,14 @@ test('change color of top border', t => { chalk.green( `${cliBoxes.round.topLeft}${cliBoxes.round.top.repeat(7)}${ cliBoxes.round.topRight - }` + }`, ), `${cliBoxes.round.left}Content${cliBoxes.round.right}`, `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight }`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -650,7 +650,7 @@ test('change color of bottom border', t => { Content Below - + , ); t.is( @@ -664,10 +664,10 @@ test('change color of bottom border', t => { chalk.green( `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight - }` + }`, ), - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -679,7 +679,7 @@ test('change color of left border', t => { Content Below - + , ); t.is( @@ -693,8 +693,8 @@ test('change color of left border', t => { `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight }`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -706,7 +706,7 @@ test('change color of right border', t => { Content Below - + , ); t.is( @@ -720,8 +720,8 @@ test('change color of right border', t => { `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight }`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -736,11 +736,11 @@ test('custom border style', t => { bottomLeft: '↗', bottom: '↑', bottomRight: '↖', - right: '←' + right: '←', }} > Content - + , ); t.is(output, boxen('Content', {width: 100, borderStyle: 'arrow'})); @@ -750,7 +750,7 @@ test('dim border color', t => { const output = renderToString( Content - + , ); t.is( @@ -758,8 +758,8 @@ test('dim border color', t => { boxen('Content', { width: 100, borderStyle: 'round', - dimBorder: true - }) + dimBorder: true, + }), ); }); @@ -771,7 +771,7 @@ test('dim top border color', t => { Content Below - + , ); t.is( @@ -781,14 +781,14 @@ test('dim top border color', t => { chalk.dim( `${cliBoxes.round.topLeft}${cliBoxes.round.top.repeat(7)}${ cliBoxes.round.topRight - }` + }`, ), `${cliBoxes.round.left}Content${cliBoxes.round.right}`, `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight }`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -800,7 +800,7 @@ test('dim bottom border color', t => { Content Below - + , ); t.is( @@ -814,10 +814,10 @@ test('dim bottom border color', t => { chalk.dim( `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight - }` + }`, ), - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -829,7 +829,7 @@ test('dim left border color', t => { Content Below - + , ); t.is( @@ -843,8 +843,8 @@ test('dim left border color', t => { `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight }`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); @@ -856,7 +856,7 @@ test('dim right border color', t => { Content Below - + , ); t.is( @@ -870,7 +870,7 @@ test('dim right border color', t => { `${cliBoxes.round.bottomLeft}${cliBoxes.round.bottom.repeat(7)}${ cliBoxes.round.bottomRight }`, - 'Below' - ].join('\n') + 'Below', + ].join('\n'), ); }); diff --git a/test/components.tsx b/test/components.tsx index 06989b1d7..29690d76a 100644 --- a/test/components.tsx +++ b/test/components.tsx @@ -12,7 +12,7 @@ import { Static, Text, Transform, - useStdin + useStdin, } from '../src/index.js'; import createStdout from './helpers/create-stdout.js'; import {renderToString} from './helpers/render-to-string.js'; @@ -35,7 +35,7 @@ test('multiple text nodes', t => { {'Hello'} {' World'} - + , ); t.is(output, 'Hello World'); @@ -49,7 +49,7 @@ test('text with component', t => { const output = renderToString( Hello - + , ); t.is(output, 'Hello World'); @@ -59,7 +59,7 @@ test('text with fragment', t => { const output = renderToString( Hello <>World {/* eslint-disable-line react/jsx-no-useless-fragment */} - + , ); t.is(output, 'Hello World'); @@ -69,7 +69,7 @@ test('wrap text', t => { const output = renderToString( Hello World - + , ); t.is(output, 'Hello\nWorld'); @@ -79,7 +79,7 @@ test('don’t wrap text if there is enough space', t => { const output = renderToString( Hello World - + , ); t.is(output, 'Hello World'); @@ -89,7 +89,7 @@ test('truncate text in the end', t => { const output = renderToString( Hello World - + , ); t.is(output, 'Hello …'); @@ -99,7 +99,7 @@ test('truncate text in the middle', t => { const output = renderToString( Hello World - + , ); t.is(output, 'Hel…rld'); @@ -109,7 +109,7 @@ test('truncate text in the beginning', t => { const output = renderToString( Hello World - + , ); t.is(output, '… World'); @@ -122,7 +122,7 @@ test('ignore empty text node', t => { Hello World {''} - + , ); t.is(output, 'Hello World'); @@ -158,13 +158,13 @@ test('fail when text nodes are not within component', t => { Hello World - + , ); t.truthy(error); t.is( error?.message, - 'Text string "Hello" must be rendered inside component' + 'Text string "Hello" must be rendered inside component', ); }); @@ -184,13 +184,13 @@ test('fail when text node is not within component', t => { renderToString( Hello World - + , ); t.truthy(error); t.is( error?.message, - 'Text string "Hello World" must be rendered inside component' + 'Text string "Hello World" must be rendered inside component', ); }); @@ -213,7 +213,7 @@ test('fail when is inside component', t => { Hello World - + , ); t.truthy(error); @@ -227,7 +227,7 @@ test('remesure text dimensions on text change', t => { Hello , - {stdout, debug: true} + {stdout, debug: true}, ); t.is((stdout.write as any).lastCall.args[0], 'Hello'); @@ -235,7 +235,7 @@ test('remesure text dimensions on text change', t => { rerender( Hello World - + , ); t.is((stdout.write as any).lastCall.args[0], 'Hello World'); @@ -246,7 +246,7 @@ test('fragment', t => { // eslint-disable-next-line react/jsx-no-useless-fragment <> Hello World - + , ); t.is(output, 'Hello World'); @@ -264,7 +264,7 @@ test('transform children', t => { test - + , ); t.is(output, '[0: {0: test}]'); @@ -283,7 +283,7 @@ test('squash multiple text nodes', t => { hello{' '}world - + , ); t.is(output, '[0: {0: hello world}]'); @@ -296,7 +296,7 @@ test('transform with multiple lines', t => { > {/* prettier-ignore */} hello{' '}world{'\n'}goodbye{' '}world - + , ); t.is(output, '[0: hello world]\n[1: goodbye world]'); @@ -315,7 +315,7 @@ test('squash multiple nested text nodes', t => { world - + , ); t.is(output, '[0: {0: hello world}]'); @@ -329,7 +329,7 @@ test('squash empty `` nodes', t => { {[]} - + , ); t.is(output, ''); @@ -366,7 +366,7 @@ test('static output', t => { X - + , ); t.is(output, 'A\nB\nC\n\n\nX'); @@ -383,7 +383,7 @@ test('skip previous output when rendering new static output', t => { const {rerender} = render(, { stdout, - debug: true + debug: true, }); t.is((stdout.write as any).lastCall.args[0], 'A\n'); @@ -403,7 +403,7 @@ test('render only new items in static output on final render', t => { const {rerender, unmount} = render(, { stdout, - debug: true + debug: true, }); t.is((stdout.write as any).lastCall.args[0], ''); @@ -432,7 +432,7 @@ test('replace child node with text', t => { const {rerender} = render(, { stdout, - debug: true + debug: true, }); t.is((stdout.write as any).lastCall.args[0], chalk.green('test')); @@ -455,7 +455,7 @@ test('disable raw mode when all input components are unmounted', t => { const options = { stdout, stdin, - debug: true + debug: true, }; class Input extends React.Component<{setRawMode: (mode: boolean) => void}> { @@ -474,7 +474,7 @@ test('disable raw mode when all input components are unmounted', t => { function Test({ renderFirstInput, - renderSecondInput + renderSecondInput, }: { readonly renderFirstInput?: boolean; readonly renderSecondInput?: boolean; @@ -492,7 +492,7 @@ test('disable raw mode when all input components are unmounted', t => { const {rerender} = render( , // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - options as any + options as any, ); t.true(stdin.setRawMode.calledOnce); @@ -527,7 +527,7 @@ test('setRawMode() should throw if raw mode is not supported', t => { const options = { stdout, stdin, - debug: true + debug: true, }; class Input extends React.Component<{setRawMode: (mode: boolean) => void}> { @@ -576,7 +576,7 @@ test('render different component based on whether stdin is a TTY or not', t => { const options = { stdout, stdin, - debug: true + debug: true, }; class Input extends React.Component<{setRawMode: (mode: boolean) => void}> { @@ -595,7 +595,7 @@ test('render different component based on whether stdin is a TTY or not', t => { function Test({ renderFirstInput, - renderSecondInput + renderSecondInput, }: { readonly renderFirstInput?: boolean; readonly renderSecondInput?: boolean; @@ -617,7 +617,7 @@ test('render different component based on whether stdin is a TTY or not', t => { const {rerender} = render( , // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - options as any + options as any, ); t.false(stdin.setRawMode.called); @@ -635,7 +635,7 @@ test('render only last frame when run in CI', async t => { const output = await run('ci', { // eslint-disable-next-line @typescript-eslint/naming-convention env: {CI: 'true'}, - columns: 0 + columns: 0, }); for (const num of [0, 1, 2, 3, 4]) { @@ -649,7 +649,7 @@ test('render all frames if CI environment variable equals false', async t => { const output = await run('ci', { // eslint-disable-next-line @typescript-eslint/naming-convention env: {CI: 'false'}, - columns: 0 + columns: 0, }); for (const num of [0, 1, 2, 3, 4, 5]) { @@ -674,7 +674,7 @@ test('reset prop when it’s removed from the element', t => { const {rerender} = render(, { stdout, - debug: true + debug: true, }); t.is((stdout.write as any).lastCall.args[0], '\n\n\nx'); @@ -689,7 +689,7 @@ test('newline', t => { Hello World - + , ); t.is(output, 'Hello\nWorld'); }); @@ -700,7 +700,7 @@ test('multiple newlines', t => { Hello World - + , ); t.is(output, 'Hello\n\nWorld'); }); @@ -711,7 +711,7 @@ test('horizontal spacer', t => { Left Right - + , ); t.is(output, 'Left Right'); @@ -723,7 +723,7 @@ test('vertical spacer', t => { Top Bottom - + , ); t.is(output, 'Top\n\n\n\n\nBottom'); @@ -731,7 +731,7 @@ test('vertical spacer', t => { test('link ansi escapes are closed properly', t => { const output = renderToString( - {ansiEscapes.link('Example', 'https://example.com')} + {ansiEscapes.link('Example', 'https://example.com')}, ); t.is(output, ']8;;https://example.comExample]8;;'); diff --git a/test/display.tsx b/test/display.tsx index 16d82287e..28ada7688 100644 --- a/test/display.tsx +++ b/test/display.tsx @@ -7,7 +7,7 @@ test('display flex', t => { const output = renderToString( X - + , ); t.is(output, 'X'); }); @@ -19,7 +19,7 @@ test('display none', t => { Kitty! Doggo - + , ); t.is(output, 'Doggo'); diff --git a/test/errors.tsx b/test/errors.tsx index dee207ae4..6da4a9f48 100644 --- a/test/errors.tsx +++ b/test/errors.tsx @@ -42,7 +42,7 @@ test('catch and display error', t => { ' 24:', ' 25: render(, {stdout});', '', - ' - Test (test/errors.tsx:22:9)' - ] + ' - Test (test/errors.tsx:22:9)', + ], ); }); diff --git a/test/exit.tsx b/test/exit.tsx index 8d07a3e3d..64d6971ed 100644 --- a/test/exit.tsx +++ b/test/exit.tsx @@ -62,21 +62,21 @@ test.serial('don’t exit while raw mode is active', async t => { const env: Record = { ...process.env, // eslint-disable-next-line @typescript-eslint/naming-convention - NODE_NO_WARNINGS: '1' + NODE_NO_WARNINGS: '1', }; const term = spawn( 'node', [ '--loader=ts-node/esm', - path.join(__dirname, './fixtures/exit-double-raw-mode.tsx') + path.join(__dirname, './fixtures/exit-double-raw-mode.tsx'), ], { name: 'xterm-color', cols: 100, cwd: __dirname, - env - } + env, + }, ); let output = ''; diff --git a/test/fixtures/ci.tsx b/test/fixtures/ci.tsx index 17a62ce8a..7eb989a00 100644 --- a/test/fixtures/ci.tsx +++ b/test/fixtures/ci.tsx @@ -11,7 +11,7 @@ class Test extends React.Component, TestState> { override state: TestState = { items: [], - counter: 0 + counter: 0, }; override render() { @@ -34,7 +34,7 @@ class Test extends React.Component, TestState> { this.setState(prevState => ({ counter: prevState.counter + 1, - items: [...prevState.items, `#${prevState.counter + 1}`] + items: [...prevState.items, `#${prevState.counter + 1}`], })); this.timer = setTimeout(onTimeout, 100); diff --git a/test/fixtures/exit-on-exit-with-error.tsx b/test/fixtures/exit-on-exit-with-error.tsx index e2c467a12..496684b5d 100644 --- a/test/fixtures/exit-on-exit-with-error.tsx +++ b/test/fixtures/exit-on-exit-with-error.tsx @@ -8,7 +8,7 @@ class Exit extends React.Component< timer?: NodeJS.Timeout; override state = { - counter: 0 + counter: 0, }; override render() { @@ -22,7 +22,7 @@ class Exit extends React.Component< this.timer = setInterval(() => { this.setState(prevState => ({ - counter: prevState.counter + 1 + counter: prevState.counter + 1, })); }, 100); } diff --git a/test/fixtures/exit-on-exit.tsx b/test/fixtures/exit-on-exit.tsx index 020591818..394e77bec 100644 --- a/test/fixtures/exit-on-exit.tsx +++ b/test/fixtures/exit-on-exit.tsx @@ -8,7 +8,7 @@ class Exit extends React.Component< timer?: NodeJS.Timeout; override state = { - counter: 0 + counter: 0, }; override render() { @@ -20,7 +20,7 @@ class Exit extends React.Component< this.timer = setInterval(() => { this.setState(prevState => ({ - counter: prevState.counter + 1 + counter: prevState.counter + 1, })); }, 100); } diff --git a/test/fixtures/exit-on-finish.tsx b/test/fixtures/exit-on-finish.tsx index 238fb9112..08566d0f1 100644 --- a/test/fixtures/exit-on-finish.tsx +++ b/test/fixtures/exit-on-finish.tsx @@ -5,7 +5,7 @@ class Test extends React.Component, {counter: number}> { timer?: NodeJS.Timeout; override state = { - counter: 0 + counter: 0, }; override render() { @@ -19,7 +19,7 @@ class Test extends React.Component, {counter: number}> { } this.setState(prevState => ({ - counter: prevState.counter + 1 + counter: prevState.counter + 1, })); this.timer = setTimeout(onTimeout, 100); diff --git a/test/fixtures/exit-on-unmount.tsx b/test/fixtures/exit-on-unmount.tsx index 8b13f863b..b8e3c8afe 100644 --- a/test/fixtures/exit-on-unmount.tsx +++ b/test/fixtures/exit-on-unmount.tsx @@ -5,7 +5,7 @@ class Test extends React.Component, {counter: number}> { timer?: NodeJS.Timeout; override state = { - counter: 0 + counter: 0, }; override render() { @@ -15,7 +15,7 @@ class Test extends React.Component, {counter: number}> { override componentDidMount() { this.timer = setInterval(() => { this.setState(prevState => ({ - counter: prevState.counter + 1 + counter: prevState.counter + 1, })); }, 100); } diff --git a/test/flex-align-items.tsx b/test/flex-align-items.tsx index 928d2d2db..b10a0a000 100644 --- a/test/flex-align-items.tsx +++ b/test/flex-align-items.tsx @@ -7,7 +7,7 @@ test('row - align text to center', t => { const output = renderToString( Test - + , ); t.is(output, '\nTest\n'); @@ -18,7 +18,7 @@ test('row - align multiple text nodes to center', t => { A B - + , ); t.is(output, '\nAB\n'); @@ -28,7 +28,7 @@ test('row - align text to bottom', t => { const output = renderToString( Test - + , ); t.is(output, '\n\nTest'); @@ -39,7 +39,7 @@ test('row - align multiple text nodes to bottom', t => { A B - + , ); t.is(output, '\n\nAB'); @@ -49,7 +49,7 @@ test('column - align text to center', t => { const output = renderToString( Test - + , ); t.is(output, ' Test'); @@ -59,7 +59,7 @@ test('column - align text to right', t => { const output = renderToString( Test - + , ); t.is(output, ' Test'); diff --git a/test/flex-align-self.tsx b/test/flex-align-self.tsx index fbee943d9..1a72af3b9 100644 --- a/test/flex-align-self.tsx +++ b/test/flex-align-self.tsx @@ -9,7 +9,7 @@ test('row - align text to center', t => { Test - + , ); t.is(output, '\nTest\n'); @@ -22,7 +22,7 @@ test('row - align multiple text nodes to center', t => { A B - + , ); t.is(output, '\nAB\n'); @@ -34,7 +34,7 @@ test('row - align text to bottom', t => { Test - + , ); t.is(output, '\n\nTest'); @@ -47,7 +47,7 @@ test('row - align multiple text nodes to bottom', t => { A B - + , ); t.is(output, '\n\nAB'); @@ -59,7 +59,7 @@ test('column - align text to center', t => { Test - + , ); t.is(output, ' Test'); @@ -71,7 +71,7 @@ test('column - align text to right', t => { Test - + , ); t.is(output, ' Test'); diff --git a/test/flex-direction.tsx b/test/flex-direction.tsx index 9ae79d483..9802a5ca5 100644 --- a/test/flex-direction.tsx +++ b/test/flex-direction.tsx @@ -8,7 +8,7 @@ test('direction row', t => { A B - + , ); t.is(output, 'AB'); @@ -19,7 +19,7 @@ test('direction row reverse', t => { A B - + , ); t.is(output, ' BA'); @@ -30,7 +30,7 @@ test('direction column', t => { A B - + , ); t.is(output, 'A\nB'); @@ -41,7 +41,7 @@ test('direction column reverse', t => { A B - + , ); t.is(output, '\n\nB\nA'); @@ -52,7 +52,7 @@ test('don’t squash text nodes when column direction is applied', t => { A B - + , ); t.is(output, 'A\nB'); diff --git a/test/flex-justify-content.tsx b/test/flex-justify-content.tsx index dbe47987e..bd0e50918 100644 --- a/test/flex-justify-content.tsx +++ b/test/flex-justify-content.tsx @@ -8,7 +8,7 @@ test('row - align text to center', t => { const output = renderToString( Test - + , ); t.is(output, ' Test'); @@ -19,7 +19,7 @@ test('row - align multiple text nodes to center', t => { A B - + , ); t.is(output, ' AB'); @@ -29,7 +29,7 @@ test('row - align text to right', t => { const output = renderToString( Test - + , ); t.is(output, ' Test'); @@ -40,7 +40,7 @@ test('row - align multiple text nodes to right', t => { A B - + , ); t.is(output, ' AB'); @@ -51,7 +51,7 @@ test('row - align two text nodes on the edges', t => { A B - + , ); t.is(output, 'A B'); @@ -64,7 +64,7 @@ test.failing('row - align two text nodes with equal space around them', t => { A B - + , ); t.is(output, ' A B'); @@ -74,7 +74,7 @@ test('row - align colored text node when text is squashed', t => { const output = renderToString( X - + , ); t.is(output, ` ${chalk.green('X')}`); @@ -84,7 +84,7 @@ test('column - align text to center', t => { const output = renderToString( Test - + , ); t.is(output, '\nTest\n'); @@ -94,7 +94,7 @@ test('column - align text to bottom', t => { const output = renderToString( Test - + , ); t.is(output, '\n\nTest'); @@ -105,7 +105,7 @@ test('column - align two text nodes on the edges', t => { A B - + , ); t.is(output, 'A\n\n\nB'); @@ -120,9 +120,9 @@ test.failing( A B - + , ); t.is(output, '\nA\n\nB\n'); - } + }, ); diff --git a/test/flex-wrap.tsx b/test/flex-wrap.tsx index d14ad8598..6458b697d 100644 --- a/test/flex-wrap.tsx +++ b/test/flex-wrap.tsx @@ -8,7 +8,7 @@ test('row - no wrap', t => { A BC - + , ); t.is(output, 'BC\n'); @@ -20,7 +20,7 @@ test('column - no wrap', t => { A B C - + , ); t.is(output, 'B\nC'); @@ -31,7 +31,7 @@ test('row - wrap content', t => { A BC - + , ); t.is(output, 'A\nBC'); @@ -43,7 +43,7 @@ test('column - wrap content', t => { A B C - + , ); t.is(output, 'AC\nB'); @@ -55,7 +55,7 @@ test('column - wrap content reverse', t => { A B C - + , ); t.is(output, ' CA\n B'); @@ -67,7 +67,7 @@ test('row - wrap content reverse', t => { A B C - + , ); t.is(output, '\nC\nAB'); diff --git a/test/flex.tsx b/test/flex.tsx index d4df30cfd..bdc86bbc8 100644 --- a/test/flex.tsx +++ b/test/flex.tsx @@ -12,7 +12,7 @@ test('grow equally', t => { B - + , ); t.is(output, 'A B'); @@ -25,7 +25,7 @@ test('grow one element', t => { A B - + , ); t.is(output, 'A B'); @@ -43,7 +43,7 @@ test('dont shrink', t => { C - + , ); t.is(output, 'A B C'); @@ -59,7 +59,7 @@ test('shrink equally', t => { B C - + , ); t.is(output, 'A B C'); @@ -72,7 +72,7 @@ test('set flex basis with flexDirection="row" container', t => { A B - + , ); t.is(output, 'A B'); @@ -85,7 +85,7 @@ test('set flex basis in percent with flexDirection="row" container', t => { A B - + , ); t.is(output, 'A B'); @@ -98,7 +98,7 @@ test('set flex basis with flexDirection="column" container', t => { A B - + , ); t.is(output, 'A\n\n\nB\n\n'); @@ -111,7 +111,7 @@ test('set flex basis in percent with flexDirection="column" container', t => { A B - + , ); t.is(output, 'A\n\n\nB\n\n'); diff --git a/test/focus.tsx b/test/focus.tsx index f884c8969..3e91d1013 100644 --- a/test/focus.tsx +++ b/test/focus.tsx @@ -43,7 +43,7 @@ function Test({ disabled = false, focusNext = false, focusPrevious = false, - unmountChildren = false + unmountChildren = false, }: TestProps) { const focusManager = useFocusManager(); @@ -89,7 +89,7 @@ type ItemProps = { function Item({label, autoFocus, disabled = false}: ItemProps) { const {isFocused} = useFocus({ autoFocus, - isActive: !disabled + isActive: !disabled, }); return ( @@ -105,14 +105,14 @@ test('dont focus on register when auto focus is off', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second', 'Third'].join('\n') + ['First', 'Second', 'Third'].join('\n'), ); }); @@ -122,14 +122,14 @@ test('focus the first component to register', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); t.is( (stdout.write as any).lastCall.args[0], - ['First ✔', 'Second', 'Third'].join('\n') + ['First ✔', 'Second', 'Third'].join('\n'), ); }); @@ -139,7 +139,7 @@ test('unfocus active component on Esc', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -147,7 +147,7 @@ test('unfocus active component on Esc', async t => { await delay(100); t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second', 'Third'].join('\n') + ['First', 'Second', 'Third'].join('\n'), ); }); @@ -157,7 +157,7 @@ test('switch focus to first component on Tab', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -166,7 +166,7 @@ test('switch focus to first component on Tab', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First ✔', 'Second', 'Third'].join('\n') + ['First ✔', 'Second', 'Third'].join('\n'), ); }); @@ -176,7 +176,7 @@ test('switch focus to the next component on Tab', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -186,7 +186,7 @@ test('switch focus to the next component on Tab', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second ✔', 'Third'].join('\n') + ['First', 'Second ✔', 'Third'].join('\n'), ); }); @@ -196,7 +196,7 @@ test('switch focus to the first component if currently focused component is the render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -206,7 +206,7 @@ test('switch focus to the first component if currently focused component is the t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second', 'Third ✔'].join('\n') + ['First', 'Second', 'Third ✔'].join('\n'), ); emitReadable(stdin, '\t'); @@ -214,7 +214,7 @@ test('switch focus to the first component if currently focused component is the t.is( (stdout.write as any).lastCall.args[0], - ['First ✔', 'Second', 'Third'].join('\n') + ['First ✔', 'Second', 'Third'].join('\n'), ); }); @@ -224,7 +224,7 @@ test('skip disabled component on Tab', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -233,7 +233,7 @@ test('skip disabled component on Tab', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second', 'Third ✔'].join('\n') + ['First', 'Second', 'Third ✔'].join('\n'), ); }); @@ -243,7 +243,7 @@ test('switch focus to the previous component on Shift+Tab', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -252,7 +252,7 @@ test('switch focus to the previous component on Shift+Tab', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second ✔', 'Third'].join('\n') + ['First', 'Second ✔', 'Third'].join('\n'), ); emitReadable(stdin, '\u001B[Z'); @@ -260,7 +260,7 @@ test('switch focus to the previous component on Shift+Tab', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First ✔', 'Second', 'Third'].join('\n') + ['First ✔', 'Second', 'Third'].join('\n'), ); }); @@ -270,7 +270,7 @@ test('switch focus to the last component if currently focused component is the f render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -278,7 +278,7 @@ test('switch focus to the last component if currently focused component is the f t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second', 'Third ✔'].join('\n') + ['First', 'Second', 'Third ✔'].join('\n'), ); }); @@ -288,7 +288,7 @@ test('skip disabled component on Shift+Tab', async t => { render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -298,7 +298,7 @@ test('skip disabled component on Shift+Tab', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First ✔', 'Second', 'Third'].join('\n') + ['First ✔', 'Second', 'Third'].join('\n'), ); }); @@ -308,7 +308,7 @@ test('reset focus when focused component unregisters', async t => { const {rerender} = render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -324,7 +324,7 @@ test('focus first component after focused component unregisters', async t => { const {rerender} = render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -338,7 +338,7 @@ test('focus first component after focused component unregisters', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['Second ✔', 'Third'].join('\n') + ['Second ✔', 'Third'].join('\n'), ); }); @@ -348,7 +348,7 @@ test('toggle focus management', async t => { const {rerender} = render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -359,7 +359,7 @@ test('toggle focus management', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First ✔', 'Second', 'Third'].join('\n') + ['First ✔', 'Second', 'Third'].join('\n'), ); rerender(); @@ -369,7 +369,7 @@ test('toggle focus management', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second ✔', 'Third'].join('\n') + ['First', 'Second ✔', 'Third'].join('\n'), ); }); @@ -379,7 +379,7 @@ test('manually focus next component', async t => { const {rerender} = render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -388,7 +388,7 @@ test('manually focus next component', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second ✔', 'Third'].join('\n') + ['First', 'Second ✔', 'Third'].join('\n'), ); }); @@ -398,7 +398,7 @@ test('manually focus previous component', async t => { const {rerender} = render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -407,7 +407,7 @@ test('manually focus previous component', async t => { t.is( (stdout.write as any).lastCall.args[0], - ['First', 'Second', 'Third ✔'].join('\n') + ['First', 'Second', 'Third ✔'].join('\n'), ); }); @@ -417,7 +417,7 @@ test('doesnt crash when focusing next on unmounted children', async t => { const {rerender} = render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); @@ -433,7 +433,7 @@ test('doesnt crash when focusing previous on unmounted children', async t => { const {rerender} = render(, { stdout, stdin, - debug: true + debug: true, }); await delay(100); diff --git a/test/gap.tsx b/test/gap.tsx index d8825b5a3..42e9c7c1e 100644 --- a/test/gap.tsx +++ b/test/gap.tsx @@ -9,7 +9,7 @@ test('gap', t => { A B C - + , ); t.is(output, 'A B\n\nC'); @@ -20,7 +20,7 @@ test('column gap', t => { A B - + , ); t.is(output, 'A B'); @@ -31,7 +31,7 @@ test('row gap', t => { A B - + , ); t.is(output, 'A\n\nB'); diff --git a/test/helpers/render-to-string.ts b/test/helpers/render-to-string.ts index f5ff11806..15d03fa7d 100644 --- a/test/helpers/render-to-string.ts +++ b/test/helpers/render-to-string.ts @@ -3,13 +3,13 @@ import createStdout from './create-stdout.js'; export const renderToString: ( node: JSX.Element, - options?: {columns: number} + options?: {columns: number}, ) => string = (node, options) => { const stdout = createStdout(options?.columns ?? 100); render(node, { stdout, - debug: true + debug: true, }); const output = stdout.get(); diff --git a/test/helpers/run.ts b/test/helpers/run.ts index 3380dc354..074ec6a9b 100644 --- a/test/helpers/run.ts +++ b/test/helpers/run.ts @@ -12,7 +12,7 @@ const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); type Run = ( fixture: string, - props?: {env?: Record; columns?: number} + props?: {env?: Record; columns?: number}, ) => Promise; export const run: Run = async (fixture, props) => { @@ -22,7 +22,7 @@ export const run: Run = async (fixture, props) => { CI: 'false', ...props?.env, // eslint-disable-next-line @typescript-eslint/naming-convention - NODE_NO_WARNINGS: '1' + NODE_NO_WARNINGS: '1', }; return new Promise((resolve, reject) => { @@ -30,14 +30,14 @@ export const run: Run = async (fixture, props) => { 'node', [ '--loader=ts-node/esm', - path.join(__dirname, `/../fixtures/${fixture}.tsx`) + path.join(__dirname, `/../fixtures/${fixture}.tsx`), ], { name: 'xterm-color', cols: typeof props?.columns === 'number' ? props.columns : 100, cwd: __dirname, - env - } + env, + }, ); let output = ''; diff --git a/test/hooks.tsx b/test/hooks.tsx index d0208ad5f..d08c0f3eb 100644 --- a/test/hooks.tsx +++ b/test/hooks.tsx @@ -21,7 +21,7 @@ const term = (fixture: string, args: string[] = []) => { // eslint-disable-next-line @typescript-eslint/naming-convention NODE_NO_WARNINGS: '1', // eslint-disable-next-line @typescript-eslint/naming-convention - CI: 'false' + CI: 'false', }; const ps = spawn( @@ -29,14 +29,14 @@ const term = (fixture: string, args: string[] = []) => { [ '--loader=ts-node/esm', path.join(__dirname, `./fixtures/${fixture}.tsx`), - ...args + ...args, ], { name: 'xterm-color', cols: 100, cwd: __dirname, - env - } + env, + }, ); const result = { @@ -48,7 +48,7 @@ const term = (fixture: string, args: string[] = []) => { }, 3000); }, output: '', - waitForExit: async () => exitPromise + waitForExit: async () => exitPromise, }; ps.onData(data => { @@ -275,7 +275,7 @@ test.serial( const thirdTry = await t.try(run); thirdTry.commit(); - } + }, ); test.serial('useStdout - write to stdout', async t => { @@ -287,7 +287,7 @@ test.serial('useStdout - write to stdout', async t => { t.deepEqual(lines.slice(1, -1), [ 'Hello from Ink to stdout', 'Hello World', - 'exited' + 'exited', ]); }); diff --git a/test/margin.tsx b/test/margin.tsx index aa1dbb301..f401d2a83 100644 --- a/test/margin.tsx +++ b/test/margin.tsx @@ -7,7 +7,7 @@ test('margin', t => { const output = renderToString( X - + , ); t.is(output, '\n\n X\n\n'); @@ -20,7 +20,7 @@ test('margin X', t => { X Y - + , ); t.is(output, ' X Y'); @@ -30,7 +30,7 @@ test('margin Y', t => { const output = renderToString( X - + , ); t.is(output, '\n\nX\n\n'); @@ -40,7 +40,7 @@ test('margin top', t => { const output = renderToString( X - + , ); t.is(output, '\n\nX'); @@ -50,7 +50,7 @@ test('margin bottom', t => { const output = renderToString( X - + , ); t.is(output, 'X\n\n'); @@ -60,7 +60,7 @@ test('margin left', t => { const output = renderToString( X - + , ); t.is(output, ' X'); @@ -73,7 +73,7 @@ test('margin right', t => { X Y - + , ); t.is(output, 'X Y'); @@ -85,7 +85,7 @@ test('nested margin', t => { X - + , ); t.is(output, '\n\n\n\n X\n\n\n\n'); @@ -95,7 +95,7 @@ test('margin with multiline string', t => { const output = renderToString( {'A\nB'} - + , ); t.is(output, '\n\n A\n B\n\n'); @@ -105,7 +105,7 @@ test('apply margin to text with newlines', t => { const output = renderToString( Hello{'\n'}World - + , ); t.is(output, '\n Hello\n World\n'); }); @@ -114,7 +114,7 @@ test('apply margin to wrapped text', t => { const output = renderToString( Hello World - + , ); t.is(output, '\n Hello\n World\n'); diff --git a/test/measure-element.tsx b/test/measure-element.tsx index 37b5e80c3..4c1072db5 100644 --- a/test/measure-element.tsx +++ b/test/measure-element.tsx @@ -7,7 +7,7 @@ import { Text, render, measureElement, - type DOMElement + type DOMElement, } from '../src/index.js'; import createStdout from './helpers/create-stdout.js'; @@ -67,6 +67,6 @@ test.serial('calculate layout while rendering is throttled', async t => { t.is( stripAnsi((stdout.write as any).lastCall.firstArg as string).trim(), - 'Width: 100' + 'Width: 100', ); }); diff --git a/test/overflow.tsx b/test/overflow.tsx index 578beb5ea..f4a26e97a 100644 --- a/test/overflow.tsx +++ b/test/overflow.tsx @@ -8,7 +8,7 @@ import {renderToString} from './helpers/render-to-string.js'; const box = (text: string, options?: Options): string => { return boxen(text, { ...options, - borderStyle: 'round' + borderStyle: 'round', }); }; @@ -25,7 +25,7 @@ test('overflowX - single text node in a box inside overflow container', t => { Hello World - + , ); t.is(output, 'Hello'); @@ -37,7 +37,7 @@ test('overflowX - single text node inside overflow container with border', t => Hello World - + , ); t.is(output, box('Hell')); @@ -49,7 +49,7 @@ test('overflowX - single text node in a box with border inside overflow containe Hello World - + , ); t.is(output, clipX(box('Hello'), 6)); @@ -62,7 +62,7 @@ test('overflowX - multiple text nodes in a box inside overflow container', t => Hello World - + , ); t.is(output, 'Hello'); @@ -75,7 +75,7 @@ test('overflowX - multiple text nodes in a box inside overflow container with bo Hello World - + , ); t.is(output, box('Hello ')); @@ -88,7 +88,7 @@ test('overflowX - multiple text nodes in a box with border inside overflow conta Hello World - + , ); t.is(output, clipX(box('HelloWo\n'), 8)); @@ -103,7 +103,7 @@ test('overflowX - multiple boxes inside overflow container', t => { World - + , ); t.is(output, 'Hello'); @@ -118,7 +118,7 @@ test('overflowX - multiple boxes inside overflow container with border', t => { World - + , ); t.is(output, box('Hello ')); @@ -130,7 +130,7 @@ test('overflowX - box before left edge of overflow container', t => { Hello - + , ); t.is(output, ''); @@ -142,7 +142,7 @@ test('overflowX - box before left edge of overflow container with border', t => Hello - + , ); t.is(output, box(' '.repeat(4))); @@ -154,7 +154,7 @@ test('overflowX - box intersecting with left edge of overflow container', t => { Hello World - + , ); t.is(output, 'lo Wor'); @@ -166,7 +166,7 @@ test('overflowX - box intersecting with left edge of overflow container with bor Hello World - + , ); t.is(output, box('lo Wor')); @@ -178,7 +178,7 @@ test('overflowX - box after right edge of overflow container', t => { Hello - + , ); t.is(output, ''); @@ -190,7 +190,7 @@ test('overflowX - box intersecting with right edge of overflow container', t => Hello - + , ); t.is(output, ' Hel'); @@ -200,7 +200,7 @@ test('overflowY - single text node inside overflow container', t => { const output = renderToString( Hello{'\n'}World - + , ); t.is(output, 'Hello'); @@ -210,7 +210,7 @@ test('overflowY - single text node inside overflow container with border', t => const output = renderToString( Hello{'\n'}World - + , ); t.is(output, box('Hello'.padEnd(18, ' '))); @@ -231,7 +231,7 @@ test('overflowY - multiple boxes inside overflow container', t => { Line #4 - + , ); t.is(output, 'Line #1\nLine #2'); @@ -258,7 +258,7 @@ test('overflowY - multiple boxes inside overflow container with border', t => { Line #4 - + , ); t.is(output, box('Line #1\nLine #2')); @@ -270,7 +270,7 @@ test('overflowY - box above top edge of overflow container', t => { Hello{'\n'}World - + , ); t.is(output, ''); @@ -282,7 +282,7 @@ test('overflowY - box above top edge of overflow container with border', t => { Hello{'\n'}World - + , ); t.is(output, box(' '.repeat(5))); @@ -294,7 +294,7 @@ test('overflowY - box intersecting with top edge of overflow container', t => { Hello{'\n'}World - + , ); t.is(output, 'World'); @@ -306,7 +306,7 @@ test('overflowY - box intersecting with top edge of overflow container with bord Hello{'\n'}World - + , ); t.is(output, box('World')); @@ -318,7 +318,7 @@ test('overflowY - box below bottom edge of overflow container', t => { Hello{'\n'}World - + , ); t.is(output, ''); @@ -330,7 +330,7 @@ test('overflowY - box below bottom edge of overflow container with border', t => Hello{'\n'}World - + , ); t.is(output, box(' '.repeat(5))); @@ -342,7 +342,7 @@ test('overflowY - box intersecting with bottom edge of overflow container', t => Hello{'\n'}World - + , ); t.is(output, 'Hello'); @@ -354,7 +354,7 @@ test('overflowY - box intersecting with bottom edge of overflow container with b Hello{'\n'}World - + , ); t.is(output, box('Hello')); @@ -368,7 +368,7 @@ test('overflow - single text node inside overflow container', t => { Hello{'\n'}World - + , ); t.is(output, 'Hello\n'); @@ -382,7 +382,7 @@ test('overflow - single text node inside overflow container with border', t => { Hello{'\n'}World - + , ); t.is(output, `${box('Hello ')}\n`); @@ -399,7 +399,7 @@ test('overflow - multiple boxes inside overflow container', t => { TR{'\n'}BR - + , ); t.is(output, 'TLTR\n'); @@ -416,7 +416,7 @@ test('overflow - multiple boxes inside overflow container with border', t => { TR{'\n'}BR - + , ); t.is(output, `${box('TLTR')}\n`); @@ -430,7 +430,7 @@ test('overflow - box intersecting with top left edge of overflow container', t = AAAA{'\n'}BBBB{'\n'}CCCC{'\n'}DDDD - + , ); t.is(output, 'CC\nDD\n\n'); @@ -444,7 +444,7 @@ test('overflow - box intersecting with top right edge of overflow container', t AAAA{'\n'}BBBB{'\n'}CCCC{'\n'}DDDD - + , ); t.is(output, ' CC\n DD\n\n'); @@ -458,7 +458,7 @@ test('overflow - box intersecting with bottom left edge of overflow container', AAAA{'\n'}BBBB{'\n'}CCCC{'\n'}DDDD - + , ); t.is(output, '\n\nAA\nBB'); @@ -472,7 +472,7 @@ test('overflow - box intersecting with bottom right edge of overflow container', AAAA{'\n'}BBBB{'\n'}CCCC{'\n'}DDDD - + , ); t.is(output, '\n\n AA\n BB'); @@ -496,7 +496,7 @@ test('nested overflow', t => { - + , ); t.is(output, 'AA\nBB\nXXXX\nYYYY\n'); @@ -506,13 +506,13 @@ test('nested overflow', t => { test('out of bounds writes do not crash', t => { const output = renderToString( , - {columns: 10} + {columns: 10}, ); const expected = boxen('', { width: 12, height: 10, - borderStyle: 'round' + borderStyle: 'round', }) .split('\n') .map((line, index) => { diff --git a/test/padding.tsx b/test/padding.tsx index 5a56e319d..f4a93b2a2 100644 --- a/test/padding.tsx +++ b/test/padding.tsx @@ -7,7 +7,7 @@ test('padding', t => { const output = renderToString( X - + , ); t.is(output, '\n\n X\n\n'); @@ -20,7 +20,7 @@ test('padding X', t => { X Y - + , ); t.is(output, ' X Y'); @@ -30,7 +30,7 @@ test('padding Y', t => { const output = renderToString( X - + , ); t.is(output, '\n\nX\n\n'); @@ -40,7 +40,7 @@ test('padding top', t => { const output = renderToString( X - + , ); t.is(output, '\n\nX'); @@ -50,7 +50,7 @@ test('padding bottom', t => { const output = renderToString( X - + , ); t.is(output, 'X\n\n'); @@ -60,7 +60,7 @@ test('padding left', t => { const output = renderToString( X - + , ); t.is(output, ' X'); @@ -73,7 +73,7 @@ test('padding right', t => { X Y - + , ); t.is(output, 'X Y'); @@ -85,7 +85,7 @@ test('nested padding', t => { X - + , ); t.is(output, '\n\n\n\n X\n\n\n\n'); @@ -95,7 +95,7 @@ test('padding with multiline string', t => { const output = renderToString( {'A\nB'} - + , ); t.is(output, '\n\n A\n B\n\n'); @@ -105,7 +105,7 @@ test('apply padding to text with newlines', t => { const output = renderToString( Hello{'\n'}World - + , ); t.is(output, '\n Hello\n World\n'); }); @@ -114,7 +114,7 @@ test('apply padding to wrapped text', t => { const output = renderToString( Hello World - + , ); t.is(output, '\n Hel\n lo\n Wor\n ld\n'); diff --git a/test/reconciler.tsx b/test/reconciler.tsx index d33db56c3..726a5e8ca 100644 --- a/test/reconciler.tsx +++ b/test/reconciler.tsx @@ -14,17 +14,17 @@ test('update child', t => { const actual = render(, { stdout: stdoutActual, - debug: true + debug: true, }); const expected = render(A, { stdout: stdoutExpected, - debug: true + debug: true, }); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); actual.rerender(); @@ -32,7 +32,7 @@ test('update child', t => { t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); }); @@ -51,17 +51,17 @@ test('update text node', t => { const actual = render(, { stdout: stdoutActual, - debug: true + debug: true, }); const expected = render(Hello A, { stdout: stdoutExpected, - debug: true + debug: true, }); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); actual.rerender(); @@ -69,7 +69,7 @@ test('update text node', t => { t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); }); @@ -96,7 +96,7 @@ test('append child', t => { const actual = render(, { stdout: stdoutActual, - debug: true + debug: true, }); const expected = render( @@ -105,13 +105,13 @@ test('append child', t => { , { stdout: stdoutExpected, - debug: true - } + debug: true, + }, ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); actual.rerender(); @@ -120,12 +120,12 @@ test('append child', t => { A B - + , ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); }); @@ -154,7 +154,7 @@ test('insert child between other children', t => { const actual = render(, { stdout: stdoutActual, - debug: true + debug: true, }); const expected = render( @@ -164,13 +164,13 @@ test('insert child between other children', t => { , { stdout: stdoutExpected, - debug: true - } + debug: true, + }, ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); actual.rerender(); @@ -180,12 +180,12 @@ test('insert child between other children', t => { A B C - + , ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); }); @@ -212,7 +212,7 @@ test('remove child', t => { const actual = render(, { stdout: stdoutActual, - debug: true + debug: true, }); const expected = render( @@ -222,13 +222,13 @@ test('remove child', t => { , { stdout: stdoutExpected, - debug: true - } + debug: true, + }, ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); actual.rerender(); @@ -236,12 +236,12 @@ test('remove child', t => { expected.rerender( A - + , ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); }); @@ -269,7 +269,7 @@ test('reorder children', t => { const actual = render(, { stdout: stdoutActual, - debug: true + debug: true, }); const expected = render( @@ -279,13 +279,13 @@ test('reorder children', t => { , { stdout: stdoutExpected, - debug: true - } + debug: true, + }, ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); actual.rerender(); @@ -294,12 +294,12 @@ test('reorder children', t => { B A - + , ); t.is( (stdoutActual.write as any).lastCall.args[0], - (stdoutExpected.write as any).lastCall.args[0] + (stdoutExpected.write as any).lastCall.args[0], ); }); @@ -312,7 +312,7 @@ test('replace child node with text', t => { const {rerender} = render(, { stdout, - debug: true + debug: true, }); t.is((stdout.write as any).lastCall.args[0], chalk.green('test')); @@ -364,7 +364,7 @@ test('support suspense', async t => { const out = render(, { stdout, - debug: true + debug: true, }); t.is((stdout.write as any).lastCall.args[0], 'Loading'); diff --git a/test/render.tsx b/test/render.tsx index 9e593d5f0..489ced4c8 100644 --- a/test/render.tsx +++ b/test/render.tsx @@ -30,7 +30,7 @@ const term = (fixture: string, args: string[] = []) => { const env = { ...process.env, // eslint-disable-next-line @typescript-eslint/naming-convention - NODE_NO_WARNINGS: '1' + NODE_NO_WARNINGS: '1', }; const ps = spawn( @@ -38,14 +38,14 @@ const term = (fixture: string, args: string[] = []) => { [ '--loader=ts-node/esm', path.join(__dirname, `./fixtures/${fixture}.tsx`), - ...args + ...args, ], { name: 'xterm-color', cols: 100, cwd: __dirname, - env - } + env, + }, ); const result = { @@ -53,7 +53,7 @@ const term = (fixture: string, args: string[] = []) => { ps.write(input); }, output: '', - waitForExit: async () => exitPromise + waitForExit: async () => exitPromise, }; ps.onData(data => { @@ -93,7 +93,7 @@ test.serial( for (const letter of ['A', 'B', 'C', 'D', 'E', 'F']) { t.true(ps.output.includes(letter)); } - } + }, ); test.serial('erase screen', async t => { @@ -116,7 +116,7 @@ test.serial( for (const letter of ['A', 'B', 'C']) { t.true(ps.output.includes(letter)); } - } + }, ); test.serial('clear output', async t => { @@ -142,9 +142,9 @@ test.serial( t.deepEqual(frames, [ 'Hello World\r\n', - 'First log\r\nHello World\r\nSecond log\r\n' + 'First log\r\nHello World\r\nSecond log\r\n', ]); - } + }, ); test.serial('rerender on resize', async t => { @@ -162,7 +162,7 @@ test.serial('rerender on resize', async t => { t.is( stripAnsi((stdout.write as any).firstCall.args[0] as string), - boxen('Test'.padEnd(8), {borderStyle: 'round'}) + '\n' + boxen('Test'.padEnd(8), {borderStyle: 'round'}) + '\n', ); t.is(stdout.listeners('resize').length, 1); @@ -173,7 +173,7 @@ test.serial('rerender on resize', async t => { t.is( stripAnsi((stdout.write as any).lastCall.args[0] as string), - boxen('Test'.padEnd(6), {borderStyle: 'round'}) + '\n' + boxen('Test'.padEnd(6), {borderStyle: 'round'}) + '\n', ); unmount(); diff --git a/test/text.tsx b/test/text.tsx index dd1a61ce9..52efa165d 100644 --- a/test/text.tsx +++ b/test/text.tsx @@ -24,7 +24,7 @@ test('text with dimmed color', t => { const output = renderToString( Test - + , ); t.is(output, chalk.green.dim('Test')); @@ -57,7 +57,7 @@ test('text with hex background color', t => { test('text with rgb background color', t => { const output = renderToString( - Test + Test, ); t.is(output, chalk.bgRgb(255, 136, 0)('Test')); @@ -65,7 +65,7 @@ test('text with rgb background color', t => { test('text with ansi256 background color', t => { const output = renderToString( - Test + Test, ); t.is(output, chalk.bgAnsi256(194)('Test')); diff --git a/test/width-height.tsx b/test/width-height.tsx index 4c37a7575..80cb2154a 100644 --- a/test/width-height.tsx +++ b/test/width-height.tsx @@ -10,7 +10,7 @@ test('set width', t => { A B - + , ); t.is(output, 'A B'); @@ -23,7 +23,7 @@ test('set width in percent', t => { A B - + , ); t.is(output, 'A B'); @@ -36,7 +36,7 @@ test('set min width', t => { A B - + , ); t.is(smallerOutput, 'A B'); @@ -47,7 +47,7 @@ test('set min width', t => { AAAAA B - + , ); t.is(largerOutput, 'AAAAAB'); @@ -60,7 +60,7 @@ test.failing('set min width in percent', t => { A B - + , ); t.is(output, 'A B'); @@ -71,7 +71,7 @@ test('set height', t => { A B - + , ); t.is(output, 'AB\n\n\n'); @@ -84,7 +84,7 @@ test('set height in percent', t => { A B - + , ); t.is(output, 'A\n\n\nB\n\n'); @@ -95,7 +95,7 @@ test('cut text over the set height', t => { AAAABBBBCCCC , - {columns: 4} + {columns: 4}, ); t.is(output, 'AAAA\nBBBB'); @@ -105,7 +105,7 @@ test('set min height', t => { const smallerOutput = renderToString( A - + , ); t.is(smallerOutput, 'A\n\n\n'); @@ -115,7 +115,7 @@ test('set min height', t => { A - + , ); t.is(largerOutput, 'A\n\n\n');