Commit graph

26 commits

Author SHA1 Message Date
Steven T. Cramer
b9f4695d12
Fix Tests to run properly on Windows (#1963)
* fix: remove -p flag from test script to prevent git operation errors

The -p flag in npm-run-all was causing tests to run in parallel, which led to 'Cannot log after tests are done' errors with git operations. These errors don't appear when running test:extension alone.

The issue occurs because git-based tests create temporary directories and run async operations that can interfere with each other when executed in parallel. Running tests sequentially resolves this cleanly.

While it might increase total test time slightly, it ensures more reliable and consistent test results.

* refactor(terminal): improve mock streams and fix test issues

- Create shell-specific mock streams (bash, cmd, pwsh) with proper line ending handling
- Fix open handles in tests by properly managing timeouts
- Standardize stderr redirection across all shell implementations using stdio option
- Improve test reliability and output cleanliness

* fix(tests): add skipVerification option to PowerShell tests to debug Linux issues

* fix(tests): use explicit variable name in PowerShell test to fix Linux compatibility

* Refactor terminal tests to use purpose-based approach instead of command mapping

* Remove reference to non-existent test file

* fix: use printf instead of echo -e for more consistent behavior across platforms

* fix: use single quotes for PowerShell commands to preserve variables on Linux

* Update code-qa workflow to run tests on both Windows and Ubuntu

* fix: use platform-specific PowerShell command execution for Linux and Windows

* Fix toggleToolAlwaysAllow to handle path normalization for cross-platform compatibility

* Fix McpHub tests to handle normalized paths on Windows

* Suppress console.error messages in McpHub tests

* fix: make Bedrock ARN regex patterns Windows-compatible

Fixed an issue where AWS Bedrock tests were timing out on Windows but passing on Linux. The root cause was path separator handling in regex patterns used for model ID extraction from ARNs.

1. Updated model ID extraction regex to handle both forward slashes (Linux) and backslashes (Windows)
2. Modified ARN matching regex to be platform-independent
3. Ensured consistent region prefix handling for all supported regions

This change maintains functionality while ensuring cross-platform compatibility.

* fix: make WorkspaceTracker test cross-platform compatible

Fixed an issue where the WorkspaceTracker test 'should initialize with workspace files' was failing on Windows but passing on Linux. The problem was in the mock implementation of toRelativePath that only handled forward slashes.

- Updated the toRelativePath mock to use path.relative which properly handles platform-specific path separators
- Ensured all paths are converted to forward slashes for consistency in test assertions
- The fix maintains cross-platform compatibility while preserving the test's intent

* fix: make WorkspaceTracker tests cross-platform compatible

Fixed cross-platform compatibility issues in the WorkspaceTracker tests that were causing failures on Windows but passing on Linux:

1. Updated the toRelativePath mock implementation to:
   - Use path.relative which properly handles platform-specific path separators
   - Convert paths to forward slashes for consistency in test assertions

2. Enhanced the 'should not update file paths' test to be platform-agnostic by:
   - Using more flexible assertions that don't depend on specific path formats
   - Checking file path length and content rather than exact string matches
   - Properly typed the test assertions to fix TypeScript errors

These changes preserve the test intent while ensuring they run successfully across different operating systems.

* fix: make McpHub tests cross-platform compatible

Fixed cross-platform compatibility issues in the McpHub tests that were causing failures on Windows but passing on Linux:

1. Made the toggleToolAlwaysAllow tests more platform-agnostic by:
   - No longer relying on specific path formats which differ between Windows and Linux
   - Using the last write call instead of searching for a specific path string
   - Adding more robust assertions that verify structure instead of exact path matches
   - Properly handling array existence checks

2. These tests would fail on Windows because paths are formatted with backslashes instead of
   forward slashes, causing path equality checks to fail.

The changes maintain test intent while ensuring cross-platform compatibility.

* handle escaping of slash and quote

* fix: ensure consistent line endings in git fallback strategy

Fixed an issue where tests would fail on GitHub Windows runners but pass on local Windows machines due to line ending differences. The fix ensures consistent line ending handling by:

1. Normalizing CRLF to LF when reading files in the git fallback strategy
2. Disabling Git's automatic line ending conversion
3. Maintaining consistent line ending usage throughout text operations

* feat: run tests sequentially on Windows, parallel otherwise
2025-03-31 23:17:56 -05:00
Chris Estreich
70a5d2b48c
Require node v20 everywhere (#922) 2025-03-19 10:46:40 -07:00
Matt Rubens
61339ee855 Add find-missing-translations as a CI check 2025-03-17 09:36:39 -04:00
cte
4b6def5f31 ContextProxy fix - constructor should not be async 2025-03-11 14:24:21 -07:00
cte
7681a98842 Simplify npm install by automatically installing npm-run-all 2025-03-10 11:36:11 -07:00
Chris Estreich
1d3f5380a8 Move integration tests into its own module 2025-02-28 21:23:11 -08:00
cte
f11c0afa1e Stabilize tests in CI 2025-02-23 02:28:10 -08:00
Matt Rubens
816847c5c0 Add Knip check for unused files 2025-02-23 01:01:51 -05:00
Matt Rubens
c0306e3e8e Revert "Merge pull request #799 from RooVetGit/cte/package-json-cleanup"
This reverts commit 00ec57afee, reversing
changes made to b83442e899.
2025-02-06 09:48:06 -05:00
Roo Code
f913d567fa Better organize package.json, optimize tasks.json, split extension and webview linting 2025-02-05 12:15:18 -08:00
cte
5c8df59889 Confirmed that check-openrouter-api-key works; remove debugging 2025-01-31 22:08:02 -08:00
cte
ab2dd09ac6 Test what happens if the secret does not exist 2025-01-31 22:06:25 -08:00
cte
de7f67f71e One more attempt 2025-01-31 22:03:33 -08:00
cte
17fb94cb1b Secrets can't be used in conditionals, apparently 2025-01-31 21:50:06 -08:00
cte
b7cd98da54 Don't run the integration-test job if there's no API key 2025-01-31 21:44:50 -08:00
cte
2e094b409d Switch to Ubuntu; we can enable the full matrix in the future if we care 2025-01-31 16:47:43 -08:00
cte
75bf341057 Try ubuntu-latest 2025-01-31 16:43:01 -08:00
cte
5fd8d8911a Fix ENV var name 2025-01-31 15:18:20 -08:00
cte
d481a5ae15 Check env.integration file 2025-01-31 14:56:57 -08:00
cte
fea3daa98a Create env.integration file 2025-01-31 14:52:25 -08:00
cte
85d1d4a77b Run integration tests in CI 2025-01-31 14:12:21 -08:00
Matt Rubens
b8e0aa0cde Custom modes 2025-01-21 09:39:54 -05:00
Matt Rubens
e14ccf55db Update unit test command to run webview tests too 2024-12-15 23:58:17 -05:00
a8trejo
51e034c399 Adding openai generated releases working along changesets 2024-12-10 14:22:30 -08:00
John Stearns
0ac3dd5753
Enabling unit tests for CI (#44) 2024-12-06 17:12:41 -08:00
ColemanRoo
b1c0e9be41
fix package.json format (#20)
* fix package.json format
add code-qa.yml step to PRs

* fix package-lock.json to use npm instead of codeartifact

* removing test step as it requires vs code

* update code owner file
2024-11-27 16:00:53 -06:00