Skip to content

Commit

Permalink
chore: migrate to colorette
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Jul 31, 2020
1 parent cf82bc6 commit 58b4712
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/serve/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function serve(...args: string[]): void {
const core = cli.getCoreFlags();

const parsedDevServerArgs = cli.argParser(devServer, args, true);
if (parsedDevServerArgs.unknownArgs.some((arg) => ['help', 'version', 'color'].includes(arg))) return;
if (parsedDevServerArgs.unknownArgs.some((arg) => ['help', 'version'].includes(arg))) return;

const devServerArgs = parsedDevServerArgs.opts;
const parsedWebpackArgs = cli.argParser(core, parsedDevServerArgs.unknownArgs, true, process.title);
Expand Down
12 changes: 5 additions & 7 deletions test/serve/basic/serve-basic.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const chalk = require('chalk');
const { yellow, options } = require('colorette');
const path = require('path');
const getPort = require('get-port');
const { runServe } = require('../../utils/test-utils');
Expand All @@ -27,12 +27,10 @@ describe('basic serve usage', () => {
console.warn('TODO: fix `serve` test on windows');
});
} else {
it('should respect the --color=false flag', async () => {
const { stdout, stderr } = await runServe(['help', '--color=false'], __dirname);
chalk.enabled = true;
chalk.level = 3;
const orange = chalk.keyword('orange');
expect(stdout).not.toContain(orange(usageText));
it('should respect the --no-color flag', async () => {
const { stdout, stderr } = await runServe(['--help', '--no-color'], __dirname);
options.enabled = true;
expect(stdout).not.toContain(yellow(usageText));
expect(stdout).toContain(descriptionText);
expect(stderr).toHaveLength(0);
});
Expand Down

0 comments on commit 58b4712

Please sign in to comment.