mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: unify two copies of monotonicTime (#15473)
This commit is contained in:
parent
799d4703bc
commit
738d71ebc2
@ -17,7 +17,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import type { FullConfig, FullResult, Reporter, Suite, TestCase } from '../../types/testReporter';
|
||||
import { monotonicTime } from '../util';
|
||||
import { monotonicTime } from 'playwright-core/lib/utils';
|
||||
import { formatFailure, formatTestTitle, stripAnsiEscapes } from './base';
|
||||
|
||||
class JUnitReporter implements Reporter {
|
||||
|
@ -23,7 +23,8 @@ import type { Loader } from './loader';
|
||||
import type { TestCase } from './test';
|
||||
import { TimeoutManager } from './timeoutManager';
|
||||
import type { Annotation, TestStepInternal } from './types';
|
||||
import { addSuffixToFilePath, getContainedPath, monotonicTime, normalizeAndSaveAttachment, sanitizeForFilePath, serializeError, trimLongString } from './util';
|
||||
import { addSuffixToFilePath, getContainedPath, normalizeAndSaveAttachment, sanitizeForFilePath, serializeError, trimLongString } from './util';
|
||||
import { monotonicTime } from 'playwright-core/lib/utils';
|
||||
|
||||
export class TestInfoImpl implements TestInfo {
|
||||
private _addStepImpl: (data: Omit<TestStepInternal, 'complete'>) => TestStepInternal;
|
||||
@ -177,7 +178,7 @@ export class TestInfoImpl implements TestInfo {
|
||||
this.status = 'timedOut';
|
||||
this.errors.push(timeoutError);
|
||||
}
|
||||
this.duration = monotonicTime() - this._startTime;
|
||||
this.duration = (monotonicTime() - this._startTime) | 0;
|
||||
}
|
||||
|
||||
async _runFn(fn: Function, skips?: 'allowSkips'): Promise<TestError | undefined> {
|
||||
|
@ -96,11 +96,6 @@ export function serializeError(error: Error | any): TestError {
|
||||
};
|
||||
}
|
||||
|
||||
export function monotonicTime(): number {
|
||||
const [seconds, nanoseconds] = process.hrtime();
|
||||
return seconds * 1000 + (nanoseconds / 1000000 | 0);
|
||||
}
|
||||
|
||||
export type Matcher = (value: string) => boolean;
|
||||
|
||||
export type FilePatternFilter = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user