Skip to content

Commit

Permalink
feat: use formatTime
Browse files Browse the repository at this point in the history
  • Loading branch information
FauxFaux committed Dec 9, 2020
1 parent 2fe7e9c commit dbb7175
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion e2e/__tests__/babelPluginJestDeadlines.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<REPLACED>>',
);
return summary;
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/deadlines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<REPLACED>>',
);
return summary;
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-circus/src/deadlineTimeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -32,7 +33,7 @@ async function timeout<T>(promise: Promise<T>, ms: number): Promise<T> {
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))
Expand Down

0 comments on commit dbb7175

Please sign in to comment.