-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
perf: optimize --merge-reports #8710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,8 @@ | |
| import type { BirpcReturn } from 'birpc' | ||
| import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../types' | ||
| import type { IframeOrchestrator } from './orchestrator' | ||
| import { parse, stringify } from '@ungap/structured-clone/json' | ||
|
Check failure on line 6 in packages/browser/src/client/client.ts
|
||
| import { createBirpc } from 'birpc' | ||
| import { parse, stringify } from 'flatted' | ||
| import { getBrowserState } from './utils' | ||
|
|
||
| const PAGE_TYPE = getBrowserState().type | ||
|
|
@@ -110,7 +110,7 @@ | |
| post: msg => ctx.ws.send(msg), | ||
| on: fn => (onMessage = fn), | ||
| serialize: e => | ||
| stringify(e, (_, v) => { | ||
|
Check failure on line 113 in packages/browser/src/client/client.ts
|
||
| if (v instanceof Error) { | ||
| return { | ||
| name: v.name, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import type { BrowserRPC, IframeChannelEvent } from '@vitest/browser/client' | ||
| import { parse } from '@ungap/structured-clone/json' | ||
|
Check failure on line 2 in packages/browser/src/client/tester/tester.ts
|
||
| import { channel, client, onCancel } from '@vitest/browser/client' | ||
| import { parse } from 'flatted' | ||
| import { page, server, userEvent } from 'vitest/browser' | ||
| import { | ||
| collectTests, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,10 +7,10 @@ | |
| import type { ParentBrowserProject } from './projectParent' | ||
| import type { BrowserServerState } from './state' | ||
| import { existsSync, promises as fs } from 'node:fs' | ||
| import { parse, stringify } from '@ungap/structured-clone/json' | ||
|
Check failure on line 10 in packages/browser/src/node/rpc.ts
|
||
| import { AutomockedModule, AutospiedModule, ManualMockedModule, RedirectedModule } from '@vitest/mocker' | ||
| import { ServerMockResolver } from '@vitest/mocker/node' | ||
| import { createBirpc } from 'birpc' | ||
| import { parse, stringify } from 'flatted' | ||
| import { dirname, join } from 'pathe' | ||
| import { createDebugger, isFileServingAllowed, isValidApiRequest } from 'vitest/node' | ||
| import { WebSocketServer } from 'ws' | ||
|
|
@@ -369,7 +369,7 @@ | |
|
|
||
| /** | ||
| * Replacer function for serialization methods such as JS.stringify() or | ||
| * flatted.stringify(). | ||
| * flatted.stringify(). // here | ||
| */ | ||
| export function stringifyReplace(key: string, value: any): any { | ||
| if (value instanceof Error) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import type { IncomingMessage, ServerResponse } from 'node:http' | ||
| import type { ProjectBrowser } from './project' | ||
| import type { ParentBrowserProject } from './projectParent' | ||
| import { stringify } from 'flatted' | ||
| import { stringify } from '@ungap/structured-clone/json' | ||
|
Check failure on line 4 in packages/browser/src/node/serverOrchestrator.ts
|
||
| import { replacer } from './utils' | ||
|
|
||
| export async function resolveOrchestrator( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
| import type { RunnerTask, RunnerTestCase } from 'vitest' | ||
| import type { ModuleGraph } from '~/composables/module-graph' | ||
| import type { Params } from '~/composables/params' | ||
| import { toJSON } from 'flatted' | ||
| import { | ||
| browserState, | ||
| client, | ||
|
|
@@ -107,10 +106,7 @@ async function loadModuleGraph(force = false) { | |
| if (hideNodeModules.value) { | ||
| // when using static html reporter, we've the meta as global, we need to clone it | ||
| if (isReport) { | ||
| moduleGraph | ||
| = typeof window.structuredClone !== 'undefined' | ||
| ? window.structuredClone(moduleGraph) | ||
| : toJSON(moduleGraph) | ||
|
Comment on lines
-110
to
-113
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understood
|
||
| moduleGraph = window.structuredClone(moduleGraph) | ||
| } | ||
| moduleGraph.inlined = moduleGraph.inlined.filter( | ||
| n => !nodeModuleRegex.test(n), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,8 @@ | |
| WebSocketEvents, | ||
| WebSocketHandlers, | ||
| } from 'vitest' | ||
| import { parse } from '@ungap/structured-clone/json' | ||
|
Check failure on line 10 in packages/ui/client/composables/client/static.ts
|
||
| import { decompressSync, strFromU8 } from 'fflate' | ||
| import { parse } from 'flatted' | ||
| import { StateManager } from '../../../../ws-client/src/state' | ||
|
|
||
| interface HTMLReportMetadata { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| import { fileURLToPath } from 'node:url' | ||
| import { promisify } from 'node:util' | ||
| import { gzip, constants as zlibConstants } from 'node:zlib' | ||
| import { stringify } from 'flatted' | ||
| import { stringify } from '@ungap/structured-clone/json' | ||
|
Check failure on line 11 in packages/ui/node/reporter.ts
|
||
| import mime from 'mime/lite' | ||
| import { dirname, extname, relative, resolve } from 'pathe' | ||
| import { globSync } from 'tinyglobby' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,9 +15,9 @@ | |
| WebSocketRPC, | ||
| } from './types' | ||
| import { existsSync, promises as fs } from 'node:fs' | ||
| import { parse, stringify } from '@ungap/structured-clone/json' | ||
|
Check failure on line 18 in packages/vitest/src/api/setup.ts
|
||
| import { noop } from '@vitest/utils/helpers' | ||
| import { createBirpc } from 'birpc' | ||
| import { parse, stringify } from 'flatted' | ||
| import { WebSocketServer } from 'ws' | ||
| import { API_PATH } from '../constants' | ||
| import { getModuleGraph } from '../utils/graph' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,8 @@ | |
| import type { BrowserProvider } from '../types/browser' | ||
| import crypto from 'node:crypto' | ||
| import * as nodeos from 'node:os' | ||
| import { stringify } from '@ungap/structured-clone/json' | ||
|
Check failure on line 9 in packages/vitest/src/node/pools/browser.ts
|
||
| import { createDefer } from '@vitest/utils/helpers' | ||
| import { stringify } from 'flatted' | ||
| import { createDebugger } from '../../utils/debugger' | ||
|
|
||
| const debug = createDebugger('vitest:browser:pool') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ function cloneByOwnProperties(value: any) { | |
|
|
||
| /** | ||
| * Replacer function for serialization methods such as JS.stringify() or | ||
| * flatted.stringify(). | ||
| * flatted.stringify(). //here | ||
|
Comment on lines
16
to
+17
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| */ | ||
| export function stringifyReplace(key: string, value: any): any { | ||
| if (value instanceof Error) { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,8 +6,8 @@ | |||||
| "test": "vitest" | ||||||
| }, | ||||||
| "devDependencies": { | ||||||
| "@ungap/structured-clone": "^1.3.0", | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be?
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, let's have it in the catalog file since it's used everywhere |
||||||
| "@vitest/runner": "workspace:*", | ||||||
| "flatted": "^3.3.3", | ||||||
| "pkg-reporter": "./reportPkg/", | ||||||
| "vitest": "workspace:*", | ||||||
| "vitest-sonar-reporter": "0.5.0" | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to write that comment correctly because the name of dep is more complicated now