From d7c2bb354445029c8a515f4d8b65ec280686108b Mon Sep 17 00:00:00 2001 From: HiDeo Date: Wed, 13 Jun 2018 13:14:05 +0200 Subject: [PATCH 1/2] Use milliseconds in console.timeEnd --- packages/jest-util/src/Console.js | 2 +- packages/jest-util/src/buffered_console.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jest-util/src/Console.js b/packages/jest-util/src/Console.js index 2ec73a81e1ed..064d9842fc2c 100644 --- a/packages/jest-util/src/Console.js +++ b/packages/jest-util/src/Console.js @@ -127,7 +127,7 @@ export default class CustomConsole extends Console { if (startTime) { const endTime = new Date(); - const time = (endTime - startTime) / 1000; + const time = endTime - startTime; this._log('time', format(`${label}: ${time}ms`)); delete this._timers[label]; } diff --git a/packages/jest-util/src/buffered_console.js b/packages/jest-util/src/buffered_console.js index 5cee80665474..434d8d194927 100644 --- a/packages/jest-util/src/buffered_console.js +++ b/packages/jest-util/src/buffered_console.js @@ -151,7 +151,7 @@ export default class BufferedConsole extends Console { if (startTime) { const endTime = new Date(); - const time = (endTime - startTime) / 1000; + const time = endTime - startTime; this._log('time', format(`${label}: ${time}ms`)); delete this._timers[label]; } From 12fde1ab44b1bae7bf14da5cf7a7ea192b7c822a Mon Sep 17 00:00:00 2001 From: HiDeo Date: Wed, 13 Jun 2018 13:36:29 +0200 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72b2a46da94f..c4806cdd3cfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - `[jest-config]` Add missing options to the `defaults` object ([#6428](https://github.com/facebook/jest/pull/6428)) - `[expect]` Using symbolic property names in arrays no longer causes the `toEqual` matcher to fail ([#6391](https://github.com/facebook/jest/pull/6391)) - `[expect]` `toEqual` no longer tries to compare non-enumerable symbolic properties, to be consistent with non-symbolic properties. ([#6398](https://github.com/facebook/jest/pull/6398)) +- `[jest-util]` `console.timeEnd` now properly log elapsed time in milliseconds. ([#6456](https://github.com/facebook/jest/pull/6456)) ### Chore & Maintenance