Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"node": ">=22"
},
"scripts": {
"pretest": "tsc --incremental -p tsconfig.json",
"start": "API_MODE=msw vite",
"start:msw": "API_MODE=msw vite",
"start:nexus": "API_MODE=nexus vite",
Expand Down Expand Up @@ -49,6 +50,7 @@
"@tanstack/react-table": "^8.20.5",
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"babel-plugin-istanbul": "^7.0.1",
"classnames": "^2.5.1",
"date-fns": "^3.6.0",
"filesize": "^10.1.6",
Expand Down Expand Up @@ -77,6 +79,7 @@
"tunnel-rat": "^0.1.2",
"use-debounce": "^10.0.4",
"uuid": "^10.0.0",
"v8-to-istanbul": "^9.3.0",
"zod": "^4.0.17",
"zustand": "^5.0.3"
},
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/action-menu.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
*
* Copyright Oxide Computer Company
*/
import { expect, test, type Page } from '@playwright/test'
import { type Page } from '@playwright/test'

import { expect, test } from './fixtures'
import { expectNotVisible } from './utils'


const openActionMenu = async (page: Page) => {
// open the action menu (use the sidenav button, as keyboard events aren't reliable in Playwright)
await page.getByRole('button', { name: 'JUMP TO' }).click()
Expand Down
44 changes: 44 additions & 0 deletions test/e2e/fixtures.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { mkdirSync, writeFileSync } from 'fs'
import { resolve } from 'path'
import { test as base } from '@playwright/test'
import v8toIstanbul from 'v8-to-istanbul'

Check failure on line 4 in test/e2e/fixtures.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find module 'v8-to-istanbul' or its corresponding type declarations.

const baseURL = 'http://localhost:4009'

export const test = base.extend({
collectCoverage: [

Check failure on line 9 in test/e2e/fixtures.ts

View workflow job for this annotation

GitHub Actions / ci

Object literal may only specify known properties, and 'collectCoverage' does not exist in type 'Fixtures<{}, {}, PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>'.
async ({ page }, use) => {

Check failure on line 10 in test/e2e/fixtures.ts

View workflow job for this annotation

GitHub Actions / ci

Parameter 'use' implicitly has an 'any' type.

Check failure on line 10 in test/e2e/fixtures.ts

View workflow job for this annotation

GitHub Actions / ci

Binding element 'page' implicitly has an 'any' type.
await page.coverage.startJSCoverage()

await use(null)

const coverage = await page.coverage.stopJSCoverage()
mkdirSync('.nyc_output', { recursive: true })

const allCoverage: Record<string, any> = {}

for (const entry of coverage) {
const localPath = entry.url.replace(baseURL, '').split('?')[0]
const cleanPath = localPath.startsWith('/') ? localPath.slice(1) : localPath
const filePath = resolve(cleanPath)

const converter = v8toIstanbul(filePath)
try {
await converter.load()
converter.applyCoverage(entry.functions)
Object.assign(allCoverage, converter.toIstanbul())
} catch (e) {
console.warn(
`Failed to convert coverage for ${filePath}:`,
e instanceof Error ? e.message : String(e)
)
}
}

writeFileSync(resolve('.nyc_output/coverage.json'), JSON.stringify(allCoverage))
},
{ auto: true },
],
})

export { expect } from '@playwright/test'
Loading