From 43f1b239b4f87383b1cd9b943365da8c795664e8 Mon Sep 17 00:00:00 2001 From: epiqueras Date: Fri, 4 Oct 2019 12:24:51 -0700 Subject: [PATCH] Env: Make tests independent from execution time. --- packages/env/test/cli.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/env/test/cli.js b/packages/env/test/cli.js index e6a5677e62b34..5d28b1b08903c 100644 --- a/packages/env/test/cli.js +++ b/packages/env/test/cli.js @@ -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(); @@ -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\)$/ ) ); } );