Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
fix: correct usage of execa
Browse files Browse the repository at this point in the history
  • Loading branch information
KnisterPeter committed Dec 20, 2019
1 parent 3ec96ad commit ccb4699
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/cli-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tslint:disable:no-implicit-dependencies
import test from 'ava';
import { shell } from 'execa';
import execa from 'execa';
import * as fs from 'fs';

function normalize(input: string): string {
Expand All @@ -12,17 +12,17 @@ function normalize(input: string): string {
test('cli should read from stdin', async t => {
const expected = fs.readFileSync('./tests/import-react-component.d.ts').toString();

const result = await shell(
`cat ./tests/import-react-component.jsx |${process.argv[0]} ./cli.js --module-name component`);
const result = await execa(
`cat ./tests/import-react-component.jsx |${process.argv[0]} ./cli.js --module-name component`, {shell: true});

t.is(normalize(result.stdout), normalize(expected));
});

test('cli should read from file', async t => {
const expected = fs.readFileSync('./tests/import-react-component.d.ts').toString();

const result = await shell(
`${process.argv[0]} ./cli.js --module-name component --file ./tests/import-react-component.jsx`);
const result = await execa(
`${process.argv[0]} ./cli.js --module-name component --file ./tests/import-react-component.jsx`, {shell: true});

t.is(normalize(result.stdout), normalize(expected));
});

0 comments on commit ccb4699

Please sign in to comment.