Skip to content

Commit

Permalink
Env: Make tests independent from execution time.
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Oct 4, 2019
1 parent e0efa05 commit 43f1b23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/env/test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ describe( 'env cli', () => {
cli().parse( [ 'start' ] );
const { spinner } = env.start.mock.calls[ 0 ][ 0 ];
await env.start.mock.results[ 0 ].value;
expect( spinner.succeed ).toHaveBeenCalledWith( 'success message (in 0s 0ms)' );
expect( spinner.succeed ).toHaveBeenCalledWith(
expect.stringMatching( /^success message \(in \d+s \d+ms\)$/ )
);
} );
it( 'handles successful commands with spinner text.', async () => {
env.start.mockResolvedValueOnce();
Expand All @@ -80,7 +82,7 @@ describe( 'env cli', () => {
spinner.text = 'success spinner text';
await env.start.mock.results[ 0 ].value;
expect( spinner.succeed ).toHaveBeenCalledWith(
'success spinner text (in 0s 0ms)'
expect.stringMatching( /^success spinner text \(in \d+s \d+ms\)$/ )
);
} );

Expand Down

0 comments on commit 43f1b23

Please sign in to comment.