Roo-Code/apps/vscode-e2e/src/runTest.ts
Chris Estreich 15e3d6fc87
feat(tests): core tools integration tests (#4433)
* feat(tests): add apply_diff tool tests

* feat(tests): add tests for write_to_file tool functionality

* feat(tests): add comprehensive tests for read_file tool functionality

* feat(tests): add tests for execute_command tool functionality

* feat(integration-tester): add integration testing role with comprehensive guidelines

* feat(tests): enhance test runner with grep and specific file filtering

* feat(tests): add comprehensive tests for search_files tool functionality

* feat(tests): add comprehensive tests for list_files tool functionality

* feat(tests): add tests for insert_content tool functionality

* feat(tests): add comprehensive tests for search_and_replace tool functionality

* feat(tests): add comprehensive tests for use_mcp_tool functionality

* feat(tests): increase timeout values for various tool tests to improve reliability

* fix(tests): add non-null assertion for workspaceDir assignment in multiple test files

* feat(tests): enhance read_file tool tests with increased timeouts and improved prompts

* feat(tests): enhance read_file tool tests to extract and verify tool results

* feat(tests): enhance execute_command tool tests with additional context in prompts

* refactor(tests): remove script execution test and related setup for execute_command tool

* fix(tests): increase timeout for task start and completion in apply_diff and read_file tests

* fix(tests): clarify error handling message in command execution test

* refactor(tests): remove error handling test and related setup for execute_command tool

* fix: update openRouterModelId to use anthropic/claude-3.5-sonnet

* fix: update openRouterModelId to use openai/gpt-4.1

* fix(tests): increase timeouts for apply_diff, execute_command, and search_and_replace tests

* fix(tests): disable terminal shell integration for execute_command tool tests

* chore: rewrite integration tester mode

* Update .roo/rules-integration-tester/1_workflow.xml

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-06-12 11:50:25 -04:00

51 lines
1.7 KiB
TypeScript

import * as path from "path"
import * as os from "os"
import * as fs from "fs/promises"
import { runTests } from "@vscode/test-electron"
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../../../src")
// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, "./suite/index")
// Create a temporary workspace folder for tests
const testWorkspace = await fs.mkdtemp(path.join(os.tmpdir(), "roo-test-workspace-"))
// Get test filter from command line arguments or environment variable
// Usage examples:
// - npm run test:e2e -- --grep "write-to-file"
// - TEST_GREP="apply-diff" npm run test:e2e
// - TEST_FILE="task.test.js" npm run test:e2e
const testGrep = process.argv.find((arg, i) => process.argv[i - 1] === "--grep") || process.env.TEST_GREP
const testFile = process.argv.find((arg, i) => process.argv[i - 1] === "--file") || process.env.TEST_FILE
// Pass test filters as environment variables to the test runner
const extensionTestsEnv = {
...process.env,
...(testGrep && { TEST_GREP: testGrep }),
...(testFile && { TEST_FILE: testFile }),
}
// Download VS Code, unzip it and run the integration test
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [testWorkspace],
extensionTestsEnv,
})
// Clean up the temporary workspace
await fs.rm(testWorkspace, { recursive: true, force: true })
} catch (error) {
console.error("Failed to run tests", error)
process.exit(1)
}
}
main()