Skip to content

Commit

Permalink
chore: migrate info command to TS (#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Stelly authored and Esemesek committed Sep 10, 2019
1 parent 6e68862 commit b49fe00
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions packages/cli/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import install from './install/install'; // eslint-disable-line
// @ts-ignore - JS file
import uninstall from './install/uninstall'; // eslint-disable-line
import upgrade from './upgrade/upgrade';
// @ts-ignore - JS file
import info from './info/info'; // eslint-disable-line
import info from './info/info';
// @ts-ignore - JS file
import config from './config/config'; // eslint-disable-line
// @ts-ignore - JS file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow
import info from '../info';
import {logger} from '@react-native-community/cli-tools';
// eslint-disable-next-line import/namespace, import/default
import loadConfig from '../../../tools/config';

jest.mock('../../../tools/config');
Expand All @@ -12,11 +13,11 @@ beforeEach(() => {
const config = loadConfig();

test('prints output without arguments', async () => {
await info.func([], config, {});
await info.func([], config);
expect(logger.info).toHaveBeenCalledWith(
'Fetching system and libraries information...',
);
const output = (logger.log: any).mock.calls[0][0];
const output = (logger.log as jest.Mock).mock.calls[0][0];
// Checking on output that should be present on all OSes.
// TODO: move to e2e tests and adjust expectations to include npm packages
expect(output).toContain('System:');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

// @ts-ignore untyped
import envinfo from 'envinfo';
import {logger} from '@react-native-community/cli-tools';
import type {ConfigT} from 'types';
import {Config} from '@react-native-community/cli-types';
// @ts-ignore - JS file
import releaseChecker from '../../tools/releaseChecker';

const info = async function getInfo(
argv: Array<string>,
ctx: ConfigT,
options: {},
) {
const info = async function getInfo(_argv: Array<string>, ctx: Config) {
try {
logger.info('Fetching system and libraries information...');
const output = await envinfo.run({
Expand Down

0 comments on commit b49fe00

Please sign in to comment.