Remove test files list from index.ts

Update documentation
Update modes.test.ts to use PR comment suggestion for pulling out reponse grade
This commit is contained in:
ColemanRoo 2025-02-13 16:08:52 -06:00
parent 1e279b4728
commit 937c3b6c49
3 changed files with 7 additions and 19 deletions

View file

@ -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

View file

@ -25,9 +25,6 @@ export async function run(): Promise<void> {
// 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)))

View file

@ -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 {
}
})