playwright/packages/playwright-core/bundles/utils/src/utilsBundleImpl.ts
Ross Wollman 06c7f1fb6c
fix(html): test and fix reporter timing display (#19670)
#19576 introduced a regression where the CLI reporters displayed some
times with way too many decimals. e.g. 7.123456789ms.

Prior to #19576, there were two monotonicTime implementations; that PR
updated the reporters to use the common definition that had existed in
utils.ts. However, that introduced a regression in the base.ts reporters
which used the ms duration humanizing package which did not account for
the more precise decimals used by the shared monotonicTime function.

This fix removes the dependency on the third-party ms package and now
consistently uses Pavel's humanize function which the HTML reporter had
been using and proved to have better defaults for decimals.
Additionally, we add more test coverage to limit future regressions
since this was caught in passing.

Closes #19556.
Relates #19576.
2022-12-22 15:57:55 -08:00

60 lines
1.7 KiB
TypeScript

/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import colorsLibrary from 'colors/safe';
export const colors = colorsLibrary;
import debugLibrary from 'debug';
export const debug = debugLibrary;
export { getProxyForUrl } from 'proxy-from-env';
export { HttpsProxyAgent } from 'https-proxy-agent';
import jpegLibrary from 'jpeg-js';
export const jpegjs = jpegLibrary;
import lockfileLibrary from 'proper-lockfile';
export const lockfile = lockfileLibrary;
import mimeLibrary from 'mime';
export const mime = mimeLibrary;
import minimatchLibrary from 'minimatch';
export const minimatch = minimatchLibrary;
export { PNG } from 'pngjs';
export { program } from 'commander';
import progressLibrary from 'progress';
export const progress = progressLibrary;
import rimrafLibrary from 'rimraf';
export const rimraf = rimrafLibrary;
export { SocksProxyAgent } from 'socks-proxy-agent';
import StackUtilsLibrary from 'stack-utils';
export const StackUtils = StackUtilsLibrary;
// @ts-ignore
import wsLibrary, { WebSocketServer, Receiver, Sender } from 'ws';
export const ws = wsLibrary;
export const wsServer = WebSocketServer;
export const wsReceiver = Receiver;
export const wsSender = Sender;