Skip to content

Commit

Permalink
refactor: style update
Browse files Browse the repository at this point in the history
  • Loading branch information
PaperStrike committed Oct 29, 2023
1 parent dab0148 commit 9c94d70
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/client/ws/route/RouteHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class RouteHandler {
this.maxHandleCount = options.times ?? Infinity;

/**
* @see [urlMatches, playwright/netUtils.ts]{@link https://github.com/microsoft/playwright/blob/76abb3a5be7cab43e97c49bac099d6eb7da9ef98/packages/playwright-core/src/common/netUtils.ts#L107}
* @see [urlMatches, playwright/netUtils.ts](https://github.com/microsoft/playwright/blob/76abb3a5be7cab43e97c49bac099d6eb7da9ef98/packages/playwright-core/src/common/netUtils.ts#L107)
*/
if (url === '') {
this.parsedMatcher = () => true;
Expand Down
2 changes: 1 addition & 1 deletion src/client/ws/route/RouteRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type playwright from 'playwright-core';
import type playwright from 'playwright';
import HostHandle from '../handle/HostHandle.js';
import { RouteRequestMeta } from '../../../common/ws/message.js';
import { FallbackOverrides } from './Route.js';
Expand Down
6 changes: 3 additions & 3 deletions src/server/BrowserLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default class BrowserLogger implements AsyncDisposable {
/**
* Print a playwright browser message to console.
* Some types of messages don't yet work well (and may never).
* @see [[BUG] console.count/countEnd event has wrong args in chromium/webkit, wrong text in firefox, and wrong type in webkit · Issue #10604 · microsoft/playwright]{@link https://github.com/microsoft/playwright/issues/10604}
* @see [[BUG] console.count/countEnd event has wrong args in chromium/webkit, wrong text in firefox, and wrong type in webkit · Issue #10604 · microsoft/playwright](https://github.com/microsoft/playwright/issues/10604)
*/
readonly forwardConsole = (message: ConsoleMessage) => {
const protocolType = message.type() as ProtocolType;
Expand Down Expand Up @@ -305,7 +305,7 @@ export default class BrowserLogger implements AsyncDisposable {
* `evaluate` does the exact same serialize steps as `jsonValue` but a lot quicker
* here as it can serialize a bunch at the same time.
* Circular references are supported on Playwright >= 1.22 but undocumented yet.
* @see import('playwright-core').JSHandle.jsonValue
* @see import('playwright').JSHandle.jsonValue
*/
const [firstIsString, args = []] = await argHandles[0].evaluate(
(firstArg, passedArgs: unknown[]) => [typeof firstArg === 'string', passedArgs],
Expand All @@ -314,7 +314,7 @@ export default class BrowserLogger implements AsyncDisposable {

/**
* If the first arg is not a string but mapped to a string, escape `%`.
* @see [Console string substitutions | MDN]{@link https://developer.mozilla.org/en-US/docs/Web/API/console#using_string_substitutions}
* @see [Console string substitutions | MDN](https://developer.mozilla.org/en-US/docs/Web/API/console#using_string_substitutions)
*/
if (!firstIsString && typeof args[0] === 'string') {
args[0] = args[0].replace(/%/g, '%%');
Expand Down
14 changes: 7 additions & 7 deletions src/server/CoverageReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { mkdir, writeFile } from 'fs/promises';
import type { Profiler } from 'inspector';
import type { SourceMapPayload } from 'module';

import type playwright from 'playwright-core';
import type playwright from 'playwright';

/**
* Playwright's `ScriptCoverage`, which has an extra `source` property.
* @see [coverage.stopJSCoverage() | Playwright]{@link https://playwright.dev/docs/api/class-coverage#coverage-stop-js-coverage}
* @see [Profiler.ScriptCoverage | Chrome DevTools Protocol]{@link https://chromedevtools.github.io/devtools-protocol/tot/Profiler/#type-ScriptCoverage}
* @see [coverage.stopJSCoverage() | Playwright](https://playwright.dev/docs/api/class-coverage#coverage-stop-js-coverage)
* @see [Profiler.ScriptCoverage | Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/tot/Profiler/#type-ScriptCoverage)
*/
type PlaywrightScriptCoverage = Awaited<ReturnType<playwright.Coverage['stopJSCoverage']>>[number];

/**
* Node.js source map cache.
* @see [Source map cache | Node.js Documentation]{@link https://nodejs.org/api/cli.html#source-map-cache}
* @see [Source map cache | Node.js Documentation](https://nodejs.org/api/cli.html#source-map-cache)
*/
interface NodeSourceMapCache {
[fileURL: string]: {
Expand All @@ -27,7 +27,7 @@ interface NodeSourceMapCache {

/**
* Node.js coverage output.
* @see [Coverage output | Node.js Documentation]{@link https://nodejs.org/api/cli.html#coverage-output}
* @see [Coverage output | Node.js Documentation](https://nodejs.org/api/cli.html#coverage-output)
*/
interface NodeCoverageOutput extends Profiler.GetBestEffortCoverageReturnType {
'source-map-cache'?: NodeSourceMapCache;
Expand Down Expand Up @@ -59,15 +59,15 @@ export type CoverageReporterOptions = {

/**
* Return an array of the length of each line.
* @see [source-map-cache.js · nodejs/node]{@link https://github.com/nodejs/node/blob/26846a05e2ac232742e6a0bfaa7baac5e86a015b/lib/internal/source_map/source_map_cache.js#L129-L139}
* @see [source-map-cache.js · nodejs/node](https://github.com/nodejs/node/blob/26846a05e2ac232742e6a0bfaa7baac5e86a015b/lib/internal/source_map/source_map_cache.js#L129-L139)
*/
const getLineLengths = (content: string) => (
content.split(/[\n\u2028\u2029]/).map((line) => line.length)
);

/**
* Return the filename the coverage should be written as.
* @see [inspector_profiler.cc · nodejs/node]{@link https://github.com/nodejs/node/blob/26846a05e2ac232742e6a0bfaa7baac5e86a015b/src/inspector_profiler.cc#L172-L179}
* @see [inspector_profiler.cc · nodejs/node](https://github.com/nodejs/node/blob/26846a05e2ac232742e6a0bfaa7baac5e86a015b/src/inspector_profiler.cc#L172-L179)
*/
const getCoverageFileName = (pid: number) => `/coverage-${pid}-${Date.now()}-0.json`;

Expand Down
2 changes: 1 addition & 1 deletion test/third-party/uvu/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* uvu has no reliable or future-proof way to run and get the test results programmatically yet.
* @see [Improve Programmatic Usage · Issue #113 · lukeed/uvu]{@link https://github.com/lukeed/uvu/issues/113}
* @see [Improve Programmatic Usage · Issue #113 · lukeed/uvu](https://github.com/lukeed/uvu/issues/113)
*/
/* eslint-disable no-console */
import { onInit, done } from 'wrightplay';
Expand Down

0 comments on commit 9c94d70

Please sign in to comment.