diff --git a/src/test/VSCODE_INTEGRATION_TESTS.md b/src/test/VSCODE_INTEGRATION_TESTS.md index 6192c4488f..96307996ce 100644 --- a/src/test/VSCODE_INTEGRATION_TESTS.md +++ b/src/test/VSCODE_INTEGRATION_TESTS.md @@ -75,6 +75,8 @@ declare global { npm run test:integration ``` +3. If you want to run a specific test, you can use the `test.only` function in the test file. This will run only the test you specify and ignore the others. + The tests will: - Download and launch a clean VSCode instance @@ -88,13 +90,7 @@ When writing new integration tests: 1. Create a new test file in `src/test/suite/` with the `.test.ts` extension -2. Add the test file to the `files` array in `suite/index.ts` (you can temporarily comment out the other tests to run just the new test): - -```typescript -const files = ["suite/modes.test.js", "suite/tasks.test.js", "suite/extension.test.js", "suite/your-new-test.test.js"] -``` - -3. Structure your tests using the TDD interface: +2. Structure your tests using the TDD interface: ```typescript import * as assert from "assert" @@ -107,7 +103,7 @@ suite("Your Test Suite Name", () => { }) ``` -4. Use the global objects (`api`, `provider`, `extension`, `panel`) to interact with the extension +3. Use the global objects (`api`, `provider`, `extension`, `panel`) to interact with the extension ### Best Practices diff --git a/src/test/suite/index.ts b/src/test/suite/index.ts index 5fe18f1ed0..ffb8de7473 100644 --- a/src/test/suite/index.ts +++ b/src/test/suite/index.ts @@ -25,9 +25,6 @@ export async function run(): Promise { // Find all test files const files = await glob("**/**.test.js", { cwd: testsRoot }) - //If you want to run a specific test, comment out the above line and uncomment the following line and add the test file to the array - //const files = ["suite/modes.test.js"] - // Add files to the test suite files.forEach((f: string) => mocha.addFile(path.resolve(testsRoot, f))) diff --git a/src/test/suite/modes.test.ts b/src/test/suite/modes.test.ts index 367e545cdd..2fe0eaa597 100644 --- a/src/test/suite/modes.test.ts +++ b/src/test/suite/modes.test.ts @@ -92,14 +92,9 @@ suite("Roo Code Modes", () => { const gradeMessage = globalThis.provider.messages.find( ({ type, text }) => type === "say" && !text?.includes("Grade: (1-10)") && text?.includes("Grade:"), )?.text - const grade = gradeMessage?.match(/Grade: (10|[1-9])/) - assert.ok( - grade?.includes("Grade: 10") || - grade?.includes("Grade: 9") || - grade?.includes("Grade: 8") || - grade?.includes("Grade: 7"), - "Did not receive expected response containing 'Grade: 10' or 'Grade: 9' or 'Grade: 8' or 'Grade: 7'", - ) + const gradeMatch = gradeMessage?.match(/Grade: (\d+)/) + const gradeNum = gradeMatch ? parseInt(gradeMatch[1]) : undefined + assert.ok(gradeNum !== undefined && gradeNum >= 7 && gradeNum <= 10, "Grade must be between 7 and 10") } finally { } })