Skip to content

Commit

Permalink
refactor: use logger
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Aug 13, 2020
1 parent b9828ac commit 95b07b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/info/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { red } from 'colorette';
import envinfo from 'envinfo';
import logger from 'webpack-cli/lib/utils/logger';
import options from './options';
import WebpackCLI from 'webpack-cli';

Expand Down Expand Up @@ -37,7 +37,7 @@ export default async function info(...args): Promise<string[]> {
const envinfoConfig = {};

if (parsedArgs.unknownArgs.length > 0) {
process.stderr.write(`Unknown argument: ${red(parsedArgs.unknownArgs)}\n`);
logger.error(`Unknown argument: ${parsedArgs.unknownArgs}`);
process.exit(2);
}

Expand All @@ -52,7 +52,7 @@ export default async function info(...args): Promise<string[]> {
envinfoConfig['json'] = true;
break;
default:
process.stderr.write(`${red(infoArgs.output)} is not a valid value for output\n`);
logger.error(`${infoArgs.output} is not a valid value for output\n`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/info/info-unknown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ const { runInfo } = require('../utils/test-utils');
describe('should handle unknown args', () => {
it('shows an appropriate warning on supplying unknown args', () => {
const { stderr } = runInfo(['--unknown'], __dirname);
expect(stderr).toContain(`Unknown argument: ${red('--unknown')}`);
expect(stderr).toContain(red('[webpack-cli] Unknown argument: --unknown'));
});
});

0 comments on commit 95b07b8

Please sign in to comment.