Skip to content
Merged
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
16 changes: 15 additions & 1 deletion apps/vscode-e2e/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import { config } from "@roo-code/config-eslint/base"

/** @type {import("eslint").Linter.Config} */
export default [...config]
export default [
...config,
{
files: ["src/**/*.ts"],
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/no-floating-promises": "error",
},
},
]
5 changes: 4 additions & 1 deletion apps/vscode-e2e/src/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,7 @@ async function main() {
}
}

main()
main().catch((error) => {
console.error("Failed to initialize or clean up tests", error)
process.exitCode = 1
})
4 changes: 3 additions & 1 deletion apps/vscode-e2e/src/suite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export async function run() {
// for a button that the webview routes to "start new task" rather than "yes".
api.on(RooCodeEventName.Message, ({ message }) => {
if (message.type === "ask" && message.ask === "completion_result") {
api.approveCurrentAsk()
void api.approveCurrentAsk().catch((error) => {
console.error("Failed to approve completion result", error)
})
}
})

Expand Down
4 changes: 2 additions & 2 deletions apps/vscode-e2e/src/suite/subtasks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ suite("Roo Code Subtasks", function () {
const parentAskCount = asks[parentTaskId]?.length ?? 0

await api.clearCurrentTask()
api.resumeTask(parentTaskId)
await api.resumeTask(parentTaskId)
await waitFor(() => hasToolAsk(parentTaskId, "newTask", parentAskCount))
assert.ok(
!asks[parentTaskId]?.slice(parentAskCount).some(({ ask }) => ask === "resume_task"),
Expand All @@ -235,7 +235,7 @@ suite("Roo Code Subtasks", function () {
const childAskCount = asks[childTaskId!]?.length ?? 0

await api.clearCurrentTask()
api.resumeTask(childTaskId!)
await api.resumeTask(childTaskId!)
await waitFor(() => hasToolAsk(childTaskId!, "finishTask", childAskCount))
assert.ok(
!asks[childTaskId!]
Expand Down
47 changes: 27 additions & 20 deletions apps/vscode-e2e/src/suite/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,41 @@ export const waitFor = (
condition: (() => Promise<boolean>) | (() => boolean),
{ timeout = 30_000, interval = 250 }: WaitForOptions = {},
) => {
let timeoutId: NodeJS.Timeout | undefined = undefined
return new Promise<void>((resolve, reject) => {
let settled = false
let intervalId: NodeJS.Timeout | undefined
const timeoutId = setTimeout(() => {
settled = true
if (intervalId) clearTimeout(intervalId)
reject(new Error(`Timeout after ${Math.floor(timeout / 1000)}s`))
}, timeout)

return Promise.race([
new Promise<void>((resolve) => {
const check = async () => {
const result = condition()
const isSatisfied = result instanceof Promise ? await result : result
const cleanup = () => {
clearTimeout(timeoutId)
if (intervalId) clearTimeout(intervalId)
}
const check = async () => {
try {
const isSatisfied = await condition()
if (settled) return

if (isSatisfied) {
if (timeoutId) {
clearTimeout(timeoutId)
timeoutId = undefined
}

settled = true
cleanup()
resolve()
} else {
setTimeout(check, interval)
intervalId = setTimeout(() => void check(), interval)
}
} catch (error) {
if (settled) return
settled = true
cleanup()
reject(error)
}
}

check()
}),
new Promise((_, reject) => {
timeoutId = setTimeout(() => {
reject(new Error(`Timeout after ${Math.floor(timeout / 1000)}s`))
}, timeout)
}),
])
void check()
})
}

type WaitUntilAbortedOptions = WaitForOptions & {
Expand Down
10 changes: 5 additions & 5 deletions apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const validFixture: WebviewThemeFixture = {
},
}

test("serializeThemeFixture sorts variables and emits stable metadata", () => {
void test("serializeThemeFixture sorts variables and emits stable metadata", () => {
const fixture: WebviewThemeFixture = {
themeId: "Default Dark Modern",
bodyClass: "vscode-dark",
Expand All @@ -45,7 +45,7 @@ test("serializeThemeFixture sorts variables and emits stable metadata", () => {
)
})

test("findDriftedFixtures reports missing and changed files in sorted order", () => {
void test("findDriftedFixtures reports missing and changed files in sorted order", () => {
const expected = new Map([
["vscode-theme-light.css", "light"],
["vscode-theme-dark.css", "dark"],
Expand All @@ -55,7 +55,7 @@ test("findDriftedFixtures reports missing and changed files in sorted order", ()
assert.deepEqual(findDriftedFixtures(expected, actual), ["vscode-theme-dark.css", "vscode-theme-light.css"])
})

test("createSerializedFixtures rejects incomplete captures", () => {
void test("createSerializedFixtures rejects incomplete captures", () => {
const fixture: WebviewThemeFixture = {
...validFixture,
variables: {
Expand All @@ -71,7 +71,7 @@ test("createSerializedFixtures rejects incomplete captures", () => {
)
})

test("createSerializedFixtures rejects an empty capture", () => {
void test("createSerializedFixtures rejects an empty capture", () => {
assert.throws(
() =>
createSerializedFixtures(new Map([["dark", { ...validFixture, variables: {} }]]), "1.100.0", [
Expand All @@ -81,7 +81,7 @@ test("createSerializedFixtures rejects an empty capture", () => {
)
})

test("createSerializedFixtures rejects the wrong theme identity", () => {
void test("createSerializedFixtures rejects the wrong theme identity", () => {
assert.throws(
() =>
createSerializedFixtures(
Expand Down
Loading