From 5ebe8de3adcf2e45c952dd5aeaf5b2848b928e94 Mon Sep 17 00:00:00 2001 From: peternhale Date: Fri, 4 Mar 2022 13:09:14 -0700 Subject: [PATCH] fix: direct styled header text thru cliux.ux.info (#387) * fix: direct syled header text thru cliux.ux.info * chore: fix copy paste errors --- src/cli-ux/styled/header.ts | 5 ++--- test/cli-ux/styled/header.test.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 test/cli-ux/styled/header.test.ts diff --git a/src/cli-ux/styled/header.ts b/src/cli-ux/styled/header.ts index ecc2c8bac..a8b266c14 100644 --- a/src/cli-ux/styled/header.ts +++ b/src/cli-ux/styled/header.ts @@ -1,7 +1,6 @@ -// tslint:disable restrict-plus-operands - import * as chalk from 'chalk' +import {CliUx} from '../../index' export default function styledHeader(header: string) { - process.stdout.write(chalk.dim('=== ') + chalk.bold(header) + '\n') + CliUx.ux.info(chalk.dim('=== ') + chalk.bold(header) + '\n') } diff --git a/test/cli-ux/styled/header.test.ts b/test/cli-ux/styled/header.test.ts new file mode 100644 index 000000000..9a1a9b095 --- /dev/null +++ b/test/cli-ux/styled/header.test.ts @@ -0,0 +1,12 @@ +import {expect, fancy} from 'fancy-test' + +import {CliUx} from '../../../src' + +describe('styled/header', () => { + fancy + .stdout() + .end('shows a styled header', output => { + CliUx.ux.styledHeader('A styled header') + expect(output.stdout).to.equal('=== A styled header\n\n') + }) +})