diff --git a/e2e/__tests__/babelPluginJestDeadlines.test.ts b/e2e/__tests__/babelPluginJestDeadlines.test.ts index 1f4799126feb..17cf81003457 100644 --- a/e2e/__tests__/babelPluginJestDeadlines.test.ts +++ b/e2e/__tests__/babelPluginJestDeadlines.test.ts @@ -39,7 +39,7 @@ it('throws on deadline exceeded', () => { function summaryWithoutTime(result: {stderr: string}) { const summary = extractSummary(result.stderr); summary.rest = summary.rest.replace( - /(waited here for) \d+ms/, + /(waited here for) \d*\.?\d+ m?s\b/, '$1 <>', ); return summary; diff --git a/e2e/__tests__/deadlines.ts b/e2e/__tests__/deadlines.ts index 47f9e3a89365..c5f968ce5ea7 100644 --- a/e2e/__tests__/deadlines.ts +++ b/e2e/__tests__/deadlines.ts @@ -37,7 +37,7 @@ it('throws on deadline exceeded in a describe hook', () => { function summaryWithoutTime(result: {stderr: string}) { const summary = extractSummary(result.stderr); summary.rest = summary.rest.replace( - /(waited here for) \d+ms/, + /(waited here for) \d*\.?\d+ m?s\b/, '$1 <>', ); return summary; diff --git a/packages/jest-circus/src/deadlineTimeout.ts b/packages/jest-circus/src/deadlineTimeout.ts index 6eee1f5bdaf5..3936953fb86e 100644 --- a/packages/jest-circus/src/deadlineTimeout.ts +++ b/packages/jest-circus/src/deadlineTimeout.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import {formatTime} from 'jest-util'; import {getState} from './state'; export function deadline(): number { @@ -32,7 +33,7 @@ async function timeout(promise: Promise, ms: number): Promise { if (await sleepCancelled) { return undefined as never; } - const here = new Error(`deadline exceeded (waited here for ${ms}ms)`); + const here = new Error(`deadline exceeded (waited here for ${formatTime(ms)})`); here.stack = here.stack ?.split('\n') .filter(line => !isUs(line))