mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-18 07:12:47 +03:00
fix(app): load component-test modules at the URLs Vite imports them by (#53091)
This commit is contained in:
committed by
GitHub
Unverified
parent
9c66a0acb0
commit
9155b7b791
@@ -1,7 +1,6 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const source = (path: string) => `/@fs/${fileURLToPath(new URL(path, import.meta.url)).replaceAll("\\", "/")}`
|
||||
const source = (path: string) => sourceURL(new URL(path, import.meta.url))
|
||||
|
||||
const modules = {
|
||||
fixture: source("../../gui-extensions/src/browser/panel.fixture.tsx"),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const source = (path: string) => `/@fs/${fileURLToPath(new URL(path, import.meta.url)).replaceAll("\\", "/")}`
|
||||
const source = (path: string) => sourceURL(new URL(path, import.meta.url))
|
||||
|
||||
const modules = {
|
||||
fixture: source("../../gui-extensions/src/browser/panel.fixture.tsx"),
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import type { Definition } from "@opencode/gui-extensions/sdk"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const source = (path: string) => `/@fs/${fileURLToPath(new URL(path, import.meta.url)).replaceAll("\\", "/")}`
|
||||
const source = (path: string) => sourceURL(new URL(path, import.meta.url))
|
||||
|
||||
const modules = {
|
||||
fixture: source("./extension-host.fixture.tsx"),
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import type { Owner } from "solid-js"
|
||||
import type { Context, Contract, DialogHandle, Dialogs, SessionRef } from "@opencode/gui-extensions/sdk"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const fixture = `/@fs/${fileURLToPath(new URL("./extension-host.fixture.tsx", import.meta.url)).replaceAll("\\", "/")}`
|
||||
const fixture = sourceURL(new URL("./extension-host.fixture.tsx", import.meta.url))
|
||||
|
||||
/** What the scoped-registration case keeps from inside its extension. */
|
||||
type Scope = { owner?: Owner | null; end: () => void; ctx?: Context }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const fixture = `/@fs/${fileURLToPath(new URL("./timeline-virtualizer.fixture.tsx", import.meta.url)).replaceAll("\\", "/")}`
|
||||
const fixture = sourceURL(new URL("./timeline-virtualizer.fixture.tsx", import.meta.url))
|
||||
|
||||
story.beforeEach(async ({ mount }) => {
|
||||
const component = await mount("opencode-composer-flow--mixed-attachments")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const fixture = `/@fs/${fileURLToPath(new URL("./basic-tool.fixture.tsx", import.meta.url)).replaceAll("\\", "/")}`
|
||||
const fixture = sourceURL(new URL("./basic-tool.fixture.tsx", import.meta.url))
|
||||
|
||||
story("does not render completed reasoning until it is opened", async ({ mount, page }) => {
|
||||
const root = await mount("current-session-timeline-rows--conversation", {
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import type { Page } from "@playwright/test"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const png = Buffer.from(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+a4ioAAAAASUVORK5CYII=",
|
||||
"base64",
|
||||
)
|
||||
|
||||
const fixture = `/@fs/${fileURLToPath(new URL("./markdown.fixture.tsx", import.meta.url)).replaceAll("\\", "/")}`
|
||||
const fixture = sourceURL(new URL("./markdown.fixture.tsx", import.meta.url))
|
||||
|
||||
story.beforeEach(async ({ mount }) => {
|
||||
const root = await mount("components-markdown--complete-response")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { fileURLToPath } from "node:url"
|
||||
import { expect, story } from "../../storybook/playwright/story"
|
||||
import { expect, sourceURL, story } from "../../storybook/playwright/story"
|
||||
|
||||
const fixture = `/@fs/${fileURLToPath(new URL("./read-image.fixture.tsx", import.meta.url)).replaceAll("\\", "/")}`
|
||||
const fixture = sourceURL(new URL("./read-image.fixture.tsx", import.meta.url))
|
||||
const png = Buffer.from(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+a4ioAAAAASUVORK5CYII=",
|
||||
"base64",
|
||||
|
||||
+5
@@ -1,6 +1,11 @@
|
||||
import { expect } from "@playwright/test";
|
||||
import type { Locator } from "@playwright/test";
|
||||
export { expect };
|
||||
/**
|
||||
* The dev server URL of a source module, in the form Vite rewrites imports to. A different spelling, such as
|
||||
* `/@fs//Users/...`, loads a second instance of the module, whose contexts the rest of the page never provides.
|
||||
*/
|
||||
export declare const sourceURL: (url: URL) => string;
|
||||
export declare const story: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
|
||||
mount: (id: string, options?: {
|
||||
args?: Record<string, string | boolean> | undefined;
|
||||
|
||||
@@ -3,6 +3,12 @@ import type { Locator } from "@playwright/test"
|
||||
|
||||
export { expect }
|
||||
|
||||
/**
|
||||
* The dev server URL of a source module, in the form Vite rewrites imports to. A different spelling, such as
|
||||
* `/@fs//Users/...`, loads a second instance of the module, whose contexts the rest of the page never provides.
|
||||
*/
|
||||
export const sourceURL = (url: URL) => `/@fs${url.pathname}`
|
||||
|
||||
export const story = test.extend<{
|
||||
mount: (
|
||||
id: string,
|
||||
|
||||
Reference in New Issue
Block a user