fix(ci): type plugin metadata fixtures without unknown casts
This commit is contained in:
1 parent
6a4a74eadf
commit
73801ce10b
4 files changed
+14
-9
No files matched your search
@@ -58,7 +58,7 @@ function textOf(value: unknown, path: string): string | undefined {
|
||||
function readObject(file: string): Record<string, unknown> {
|
||||
let contents: unknown
|
||||
try {
|
||||
contents = JSON.parse(readFileSync(file, 'utf8')) as unknown
|
||||
contents = JSON.parse(readFileSync(file, 'utf8'))
|
||||
} catch (error) {
|
||||
throw new Error(`${file}: ${String(error)}`)
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { ReactNode } from 'react'
|
||||
import { PluginManagerPage } from '../src/client/PluginManagerPage.tsx'
|
||||
import type { PluginManagerPageProps } from '../src/client/PluginManagerPage.tsx'
|
||||
import type { ConfigLedger } from '../src/client/config-ledger.ts'
|
||||
import type { PluginConfigViewProps } from '../src/client/slot-contract.ts'
|
||||
import { rowKey, type InstallState, type PackageRow, type PackageView, type PluginManagerState } from '../src/client/manager-store.ts'
|
||||
import { en, zh, type PluginManagerLocaleKey } from '../src/client/locales.ts'
|
||||
|
||||
@@ -101,15 +102,22 @@ function renderTab(state: Partial<PluginManagerState> = {}, config: Partial<Conf
|
||||
setRowEnabled: vi.fn(),
|
||||
dismissNotice: vi.fn(),
|
||||
}
|
||||
const props = {
|
||||
const unusedGlobalHook = (): never => { throw new Error('PluginManagerPage does not consume global runtime hooks') }
|
||||
const props: PluginManagerPageProps = {
|
||||
useSessions: unusedGlobalHook,
|
||||
useSessionStatus: unusedGlobalHook,
|
||||
useSessionRetainInfo: unusedGlobalHook,
|
||||
usePanelInfo: unusedGlobalHook,
|
||||
useResource: unusedGlobalHook,
|
||||
useWorkspaces: unusedGlobalHook,
|
||||
t,
|
||||
resolveText,
|
||||
...actions,
|
||||
usePluginManager: bindSnapshotSelector(store),
|
||||
useConfigLedger: bindSnapshotSelector(ledger),
|
||||
renderSlot: (name: string, owner: { view: 'summary' | 'page' }, opts: { only?: string; entryKey?: string }) =>
|
||||
bodies[`${name}:${opts.only ?? opts.entryKey ?? ''}`]?.(owner.view) ?? null,
|
||||
} as unknown as PluginManagerPageProps
|
||||
renderSlot: (name, owner: PluginConfigViewProps, opts) =>
|
||||
bodies[`${name}:${opts?.only ?? opts?.entryKey ?? ''}`]?.(owner.view) ?? null,
|
||||
}
|
||||
const { rerender } = render(<PluginManagerPage {...props} />)
|
||||
return {
|
||||
store,
|
||||
|
||||
@@ -671,9 +671,6 @@
|
||||
"packages/client/ui-plugin-manager/tests/browser-plugin.client.spec.tsx": {
|
||||
"04984a2ce1486250236e638e0197da0a1a840855ed3975c59130a85358c7e5fe": 1
|
||||
},
|
||||
"packages/client/ui-plugin-manager/tests/components.client.spec.tsx": {
|
||||
"624ce7f0e7acb423fcd3937994cd5ca0916ac27b76cb56a7587025f209a14351": 1
|
||||
},
|
||||
"packages/client/ui-primitives/tests/highlight-viewport.client.spec.tsx": {
|
||||
"6061de0a1e01547eb1abf9d4e1b5fa79fda112fa35dda980775491123413dcce": 1
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ function sourceJsonFiles(dir: string): SourceJson[] {
|
||||
const file = path.replaceAll('\\', '/')
|
||||
let contents: unknown
|
||||
try {
|
||||
contents = JSON.parse(readFileSync(join(dir, file), 'utf8')) as unknown
|
||||
contents = JSON.parse(readFileSync(join(dir, file), 'utf8'))
|
||||
} catch (_error) {
|
||||
return { file, metadata: false, invalid: true }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user