From 94cfde8025df8b93c1aa0f6dfc3ae11048ec45f2 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sat, 5 Dec 2026 20:25:20 +0800 Subject: [PATCH] ci: reduce PR runner pressure, cache churn, Rust link count, and test runtime (#8218) * ci: fix rust-cache eviction, group language smoke, and drop unused Rust setup * test(frontend): use Vitest threads pool and guard DOM setup for node tests * test(rust): consolidate crate integration tests into single binaries --- .config/nextest.toml | 2 +- .github/workflows/ci.yml | 20 ++- .github/workflows/language-smoke.yml | 111 +++++++++----- .../tests/{ => integration}/debugpy.rs | 0 .../ide-dap/tests/{ => integration}/godot.rs | 0 crates/ide-dap/tests/integration/main.rs | 6 + .../tests/{ => integration}/php_debug.rs | 0 .../tests/{ => integration}/real_adapters.rs | 0 .../{ => integration}/script_debuggers.rs | 0 .../ide-dap/tests/{ => integration}/unity.rs | 0 .../tests/{ => integration}/clickhouse.rs | 0 crates/ide-db/tests/{ => integration}/jdbc.rs | 0 crates/ide-db/tests/integration/main.rs | 11 ++ .../ide-db/tests/{ => integration}/mysql.rs | 0 .../{ => integration}/pg_console_sessions.rs | 0 .../pg_console_transactions.rs | 0 .../tests/{ => integration}/postgres.rs | 4 +- .../tests/{ => integration}/snowflake.rs | 2 +- .../ide-db/tests/{ => integration}/sqlite.rs | 0 .../sqlite_console_sessions.rs | 0 .../tests/{ => integration}/sqlserver.rs | 0 .../tests/{ => integration}/ssh_tunnel.rs | 0 .../{ => integration}/agent_approvals.rs | 2 +- .../{ => integration}/agent_automations.rs | 2 +- .../{ => integration}/agent_env_secrets.rs | 2 +- .../tests/{ => integration}/agent_mcp.rs | 2 +- .../{ => integration}/agent_model_refresh.rs | 3 +- .../{ => integration}/attached_excludes.rs | 2 +- .../tests/{ => integration}/binary_args.rs | 2 +- .../tests/{ => integration}/close_project.rs | 3 +- .../{ => integration}/container_php_real.rs | 2 +- .../container_python_real.rs | 3 +- .../tests/{ => integration}/csharpier.rs | 2 +- .../tests/{ => integration}/data_dirs.rs | 2 +- .../tests/{ => integration}/db_consoles.rs | 2 +- .../{ => integration}/debug_jvm_memory_ipc.rs | 2 +- .../tests/{ => integration}/directory_sync.rs | 2 +- .../tests/{ => integration}/distribution.rs | 0 .../docker_run_targets_real.rs | 3 +- .../tests/{ => integration}/external_log.rs | 2 +- .../tests/{ => integration}/gradle_linkage.rs | 2 +- .../tests/{ => integration}/ij_svn_roots.rs | 2 +- .../tests/{ => integration}/java_build.rs | 14 +- .../jdtls_excluded_checkout.rs | 0 .../tests/{ => integration}/light_edit.rs | 2 +- crates/ide-host/tests/integration/main.rs | 101 +++++++++++++ .../tests/{ => integration}/maven_external.rs | 2 +- .../ide-host/tests/{ => integration}/mcp.rs | 2 +- .../tests/{ => integration}/mcp_secrets.rs | 2 +- .../{ => integration}/nav_inheritance.rs | 2 +- .../tests/{ => integration}/network_images.rs | 1 - .../tests/{ => integration}/open_project.rs | 2 +- .../{ => integration}/plugin_clipboard.rs | 0 .../plugin_code_semantics.rs | 2 +- .../tests/{ => integration}/plugin_commit.rs | 0 .../plugin_completion_list.rs | 2 +- .../plugin_completion_resolve.rs | 2 +- .../{ => integration}/plugin_data_tools.rs | 2 +- .../{ => integration}/plugin_database_open.rs | 2 +- .../{ => integration}/plugin_dependencies.rs | 0 .../{ => integration}/plugin_diagnostics.rs | 2 +- .../tests/{ => integration}/plugin_hover.rs | 0 .../{ => integration}/plugin_indexing.rs | 0 .../{ => integration}/plugin_inlay_hints.rs | 0 .../plugin_language_features.rs | 2 +- .../{ => integration}/plugin_project_view.rs | 2 +- .../{ => integration}/plugin_refactoring.rs | 2 +- .../tests/{ => integration}/plugin_rename.rs | 2 +- .../{ => integration}/plugin_run_anything.rs | 0 .../{ => integration}/plugin_run_output.rs | 2 +- .../plugin_semantic_tokens.rs | 0 .../plugin_server_commands.rs | 2 +- .../tests/{ => integration}/plugin_symbols.rs | 0 .../plugin_syntax_decorations.rs | 2 +- .../{ => integration}/plugin_view_badge.rs | 0 .../{ => integration}/plugin_watch_paths.rs | 0 .../{ => integration}/plugin_workbench.rs | 2 +- .../tests/{ => integration}/pom_encoding.rs | 2 +- .../tests/{ => integration}/properties.rs | 2 +- .../{ => integration}/pytest_fixtures.rs | 2 +- .../tests/{ => integration}/python_move.rs | 2 +- .../python_rename_comments.rs | 2 +- .../{ => integration}/python_signature.rs | 0 .../{ => integration}/python_signature_ops.rs | 2 +- .../tests/{ => integration}/remote_daemon.rs | 2 - .../tests/{ => integration}/remote_plugins.rs | 4 +- .../tests/{ => integration}/replace_all.rs | 2 +- .../{ => integration}/roslyn_editorconfig.rs | 2 +- .../tests/{ => integration}/roslyn_hints.rs | 2 +- .../ide-host/tests/{ => integration}/rpc.rs | 2 +- .../tests/{ => integration}/run_configs.rs | 2 +- .../{ => integration}/search_encoding.rs | 2 +- .../tests/{ => integration}/settings_sync.rs | 2 +- .../{ => integration}/spell_dictionary.rs | 0 .../tests/{ => integration}/ssh_terminal.rs | 2 +- .../ide-host/tests/{ => integration}/svn.rs | 2 +- .../{ => integration}/terminal_images.rs | 4 +- .../ide-host/tests/{ => integration}/trust.rs | 2 +- .../{ => integration}/trust_git_binary.rs | 6 +- .../{ => integration}/trust_vcs_sweep.rs | 2 +- .../ide-host/tests/{ => integration}/unity.rs | 2 +- .../tests/{ => integration}/vcs_backends.rs | 2 +- .../{ => integration}/vcs_delete_added.rs | 2 +- .../tests/{ => integration}/vcs_documents.rs | 2 +- .../tests/{ => integration}/vcs_encoding.rs | 2 +- .../tests/{ => integration}/vcs_flow.rs | 2 +- .../tests/{ => integration}/vcs_roots.rs | 2 +- .../{ => integration}/vcs_shelf_roots.rs | 2 +- .../vcs_watcher_moved_repository.rs | 2 +- .../tests/{ => integration}/vcs_worktrees.rs | 2 +- .../{ => integration}/workspace_edits.rs | 2 +- .../tests/{ => integration}/workspaces.rs | 2 +- crates/ide-lsp/tests/integration/main.rs | 5 + .../tests/{ => integration}/mock_server.rs | 0 .../tests/{ => integration}/real_servers.rs | 8 +- .../tests/{ => integration}/stdio_crash.rs | 1 - .../tests/{ => integration}/tcp_server.rs | 0 .../ide-run/tests/{ => integration}/config.rs | 0 .../ide-run/tests/{ => integration}/detect.rs | 0 .../ide-run/tests/{ => integration}/dotnet.rs | 0 .../tests/{ => integration}/dotnet_cli.rs | 0 .../{ => integration}/import_jetbrains.rs | 0 .../tests/{ => integration}/import_vscode.rs | 0 crates/ide-run/tests/integration/main.rs | 15 ++ .../tests/{ => integration}/process.rs | 2 - .../tests/{ => integration}/stop_group.rs | 1 - .../tests/{ => integration}/stop_tree.rs | 1 - .../{ => integration}/tomcat_artifact.rs | 0 .../tests/{ => integration}/windows_output.rs | 136 +++++++++--------- .../tests/{ => integration}/feedback.rs | 4 +- .../tests/{ => integration}/ij_auth.rs | 4 +- .../tests/{ => integration}/ij_changelists.rs | 4 +- .../tests/{ => integration}/ij_committed.rs | 4 +- .../tests/{ => integration}/ij_externals.rs | 4 +- .../tests/{ => integration}/ij_files.rs | 4 +- .../tests/{ => integration}/ij_history.rs | 4 +- .../tests/{ => integration}/ij_merge.rs | 4 +- .../{ => integration}/ij_rename_rollback.rs | 4 +- .../incoming_and_branches.rs | 3 +- crates/ide-svn/tests/integration/main.rs | 20 +++ .../ide-svn/tests/{ => integration}/matrix.rs | 4 +- .../tests/{ => integration}/merge_ui.rs | 2 +- .../tests/{ => integration}/remote_browser.rs | 3 +- .../tests/{ => integration}/settings.rs | 4 +- .../ide-svn/tests/{ => integration}/shelf.rs | 3 +- .../ide-svn/tests/{ => integration}/wc_ops.rs | 2 +- .../tests/{ => integration}/working_copy.rs | 4 +- .../tests/{ => integration}/blame_ignore.rs | 0 .../tests/{ => integration}/block_history.rs | 0 .../tests/{ => integration}/case_rename.rs | 0 .../tests/{ => integration}/git_workflows.rs | 0 .../tests/{ => integration}/history_ops.rs | 0 .../ide-vcs/tests/{ => integration}/ignore.rs | 0 crates/ide-vcs/tests/{ => integration}/lfs.rs | 0 .../tests/{ => integration}/log_lock.rs | 1 - .../tests/{ => integration}/log_projection.rs | 0 .../tests/{ => integration}/log_shape.rs | 0 crates/ide-vcs/tests/integration/main.rs | 17 +++ .../tests/{ => integration}/partial_clone.rs | 0 .../ide-vcs/tests/{ => integration}/repo.rs | 0 .../tests/{ => integration}/stash_paths.rs | 0 .../{ => integration}/submodule_update.rs | 0 .../tests/{ => integration}/volume_loss.rs | 2 - .../tests/{ => integration}/documents.rs | 0 .../{ => integration}/file_operations.rs | 0 .../ide-workspace/tests/integration/main.rs | 4 + .../{ => integration}/workspace_edits.rs | 0 .../{ => integration}/write_load_invariant.rs | 0 docs/en/contribute/testing/unit-e2e.mdx | 2 +- docs/en/plugins/guides/indexing.mdx | 2 +- docs/zh/contribute/testing/unit-e2e.mdx | 2 +- docs/zh/plugins/guides/indexing.mdx | 2 +- plugins/indexing.md | 2 +- scripts/smoke-paths.test.ts | 14 ++ scripts/smoke-paths.ts | 31 +++- src/test/setup.ts | 10 +- vite.config.ts | 1 + 177 files changed, 486 insertions(+), 282 deletions(-) rename crates/ide-dap/tests/{ => integration}/debugpy.rs (100%) rename crates/ide-dap/tests/{ => integration}/godot.rs (100%) create mode 100644 crates/ide-dap/tests/integration/main.rs rename crates/ide-dap/tests/{ => integration}/php_debug.rs (100%) rename crates/ide-dap/tests/{ => integration}/real_adapters.rs (100%) rename crates/ide-dap/tests/{ => integration}/script_debuggers.rs (100%) rename crates/ide-dap/tests/{ => integration}/unity.rs (100%) rename crates/ide-db/tests/{ => integration}/clickhouse.rs (100%) rename crates/ide-db/tests/{ => integration}/jdbc.rs (100%) create mode 100644 crates/ide-db/tests/integration/main.rs rename crates/ide-db/tests/{ => integration}/mysql.rs (100%) rename crates/ide-db/tests/{ => integration}/pg_console_sessions.rs (100%) rename crates/ide-db/tests/{ => integration}/pg_console_transactions.rs (100%) rename crates/ide-db/tests/{ => integration}/postgres.rs (99%) rename crates/ide-db/tests/{ => integration}/snowflake.rs (99%) rename crates/ide-db/tests/{ => integration}/sqlite.rs (100%) rename crates/ide-db/tests/{ => integration}/sqlite_console_sessions.rs (100%) rename crates/ide-db/tests/{ => integration}/sqlserver.rs (100%) rename crates/ide-db/tests/{ => integration}/ssh_tunnel.rs (100%) rename crates/ide-host/tests/{ => integration}/agent_approvals.rs (99%) rename crates/ide-host/tests/{ => integration}/agent_automations.rs (99%) rename crates/ide-host/tests/{ => integration}/agent_env_secrets.rs (99%) rename crates/ide-host/tests/{ => integration}/agent_mcp.rs (99%) rename crates/ide-host/tests/{ => integration}/agent_model_refresh.rs (99%) rename crates/ide-host/tests/{ => integration}/attached_excludes.rs (99%) rename crates/ide-host/tests/{ => integration}/binary_args.rs (99%) rename crates/ide-host/tests/{ => integration}/close_project.rs (99%) rename crates/ide-host/tests/{ => integration}/container_php_real.rs (99%) rename crates/ide-host/tests/{ => integration}/container_python_real.rs (99%) rename crates/ide-host/tests/{ => integration}/csharpier.rs (99%) rename crates/ide-host/tests/{ => integration}/data_dirs.rs (99%) rename crates/ide-host/tests/{ => integration}/db_consoles.rs (99%) rename crates/ide-host/tests/{ => integration}/debug_jvm_memory_ipc.rs (99%) rename crates/ide-host/tests/{ => integration}/directory_sync.rs (99%) rename crates/ide-host/tests/{ => integration}/distribution.rs (100%) rename crates/ide-host/tests/{ => integration}/docker_run_targets_real.rs (99%) rename crates/ide-host/tests/{ => integration}/external_log.rs (99%) rename crates/ide-host/tests/{ => integration}/gradle_linkage.rs (99%) rename crates/ide-host/tests/{ => integration}/ij_svn_roots.rs (99%) rename crates/ide-host/tests/{ => integration}/java_build.rs (95%) rename crates/ide-host/tests/{ => integration}/jdtls_excluded_checkout.rs (100%) rename crates/ide-host/tests/{ => integration}/light_edit.rs (99%) create mode 100644 crates/ide-host/tests/integration/main.rs rename crates/ide-host/tests/{ => integration}/maven_external.rs (99%) rename crates/ide-host/tests/{ => integration}/mcp.rs (99%) rename crates/ide-host/tests/{ => integration}/mcp_secrets.rs (99%) rename crates/ide-host/tests/{ => integration}/nav_inheritance.rs (99%) rename crates/ide-host/tests/{ => integration}/network_images.rs (99%) rename crates/ide-host/tests/{ => integration}/open_project.rs (98%) rename crates/ide-host/tests/{ => integration}/plugin_clipboard.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_code_semantics.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_commit.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_completion_list.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_completion_resolve.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_data_tools.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_database_open.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_dependencies.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_diagnostics.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_hover.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_indexing.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_inlay_hints.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_language_features.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_project_view.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_refactoring.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_rename.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_run_anything.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_run_output.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_semantic_tokens.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_server_commands.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_symbols.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_syntax_decorations.rs (99%) rename crates/ide-host/tests/{ => integration}/plugin_view_badge.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_watch_paths.rs (100%) rename crates/ide-host/tests/{ => integration}/plugin_workbench.rs (99%) rename crates/ide-host/tests/{ => integration}/pom_encoding.rs (99%) rename crates/ide-host/tests/{ => integration}/properties.rs (99%) rename crates/ide-host/tests/{ => integration}/pytest_fixtures.rs (99%) rename crates/ide-host/tests/{ => integration}/python_move.rs (99%) rename crates/ide-host/tests/{ => integration}/python_rename_comments.rs (99%) rename crates/ide-host/tests/{ => integration}/python_signature.rs (100%) rename crates/ide-host/tests/{ => integration}/python_signature_ops.rs (99%) rename crates/ide-host/tests/{ => integration}/remote_daemon.rs (99%) rename crates/ide-host/tests/{ => integration}/remote_plugins.rs (99%) rename crates/ide-host/tests/{ => integration}/replace_all.rs (99%) rename crates/ide-host/tests/{ => integration}/roslyn_editorconfig.rs (99%) rename crates/ide-host/tests/{ => integration}/roslyn_hints.rs (99%) rename crates/ide-host/tests/{ => integration}/rpc.rs (99%) rename crates/ide-host/tests/{ => integration}/run_configs.rs (99%) rename crates/ide-host/tests/{ => integration}/search_encoding.rs (99%) rename crates/ide-host/tests/{ => integration}/settings_sync.rs (99%) rename crates/ide-host/tests/{ => integration}/spell_dictionary.rs (100%) rename crates/ide-host/tests/{ => integration}/ssh_terminal.rs (99%) rename crates/ide-host/tests/{ => integration}/svn.rs (99%) rename crates/ide-host/tests/{ => integration}/terminal_images.rs (97%) rename crates/ide-host/tests/{ => integration}/trust.rs (99%) rename crates/ide-host/tests/{ => integration}/trust_git_binary.rs (97%) rename crates/ide-host/tests/{ => integration}/trust_vcs_sweep.rs (99%) rename crates/ide-host/tests/{ => integration}/unity.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_backends.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_delete_added.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_documents.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_encoding.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_flow.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_roots.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_shelf_roots.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_watcher_moved_repository.rs (99%) rename crates/ide-host/tests/{ => integration}/vcs_worktrees.rs (99%) rename crates/ide-host/tests/{ => integration}/workspace_edits.rs (99%) rename crates/ide-host/tests/{ => integration}/workspaces.rs (99%) create mode 100644 crates/ide-lsp/tests/integration/main.rs rename crates/ide-lsp/tests/{ => integration}/mock_server.rs (100%) rename crates/ide-lsp/tests/{ => integration}/real_servers.rs (99%) rename crates/ide-lsp/tests/{ => integration}/stdio_crash.rs (99%) rename crates/ide-lsp/tests/{ => integration}/tcp_server.rs (100%) rename crates/ide-run/tests/{ => integration}/config.rs (100%) rename crates/ide-run/tests/{ => integration}/detect.rs (100%) rename crates/ide-run/tests/{ => integration}/dotnet.rs (100%) rename crates/ide-run/tests/{ => integration}/dotnet_cli.rs (100%) rename crates/ide-run/tests/{ => integration}/import_jetbrains.rs (100%) rename crates/ide-run/tests/{ => integration}/import_vscode.rs (100%) create mode 100644 crates/ide-run/tests/integration/main.rs rename crates/ide-run/tests/{ => integration}/process.rs (99%) rename crates/ide-run/tests/{ => integration}/stop_group.rs (99%) rename crates/ide-run/tests/{ => integration}/stop_tree.rs (99%) rename crates/ide-run/tests/{ => integration}/tomcat_artifact.rs (100%) rename crates/ide-run/tests/{ => integration}/windows_output.rs (96%) rename crates/ide-svn/tests/{ => integration}/feedback.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_auth.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_changelists.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_committed.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_externals.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_files.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_history.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_merge.rs (99%) rename crates/ide-svn/tests/{ => integration}/ij_rename_rollback.rs (99%) rename crates/ide-svn/tests/{ => integration}/incoming_and_branches.rs (99%) create mode 100644 crates/ide-svn/tests/integration/main.rs rename crates/ide-svn/tests/{ => integration}/matrix.rs (99%) rename crates/ide-svn/tests/{ => integration}/merge_ui.rs (99%) rename crates/ide-svn/tests/{ => integration}/remote_browser.rs (99%) rename crates/ide-svn/tests/{ => integration}/settings.rs (99%) rename crates/ide-svn/tests/{ => integration}/shelf.rs (98%) rename crates/ide-svn/tests/{ => integration}/wc_ops.rs (99%) rename crates/ide-svn/tests/{ => integration}/working_copy.rs (99%) rename crates/ide-vcs/tests/{ => integration}/blame_ignore.rs (100%) rename crates/ide-vcs/tests/{ => integration}/block_history.rs (100%) rename crates/ide-vcs/tests/{ => integration}/case_rename.rs (100%) rename crates/ide-vcs/tests/{ => integration}/git_workflows.rs (100%) rename crates/ide-vcs/tests/{ => integration}/history_ops.rs (100%) rename crates/ide-vcs/tests/{ => integration}/ignore.rs (100%) rename crates/ide-vcs/tests/{ => integration}/lfs.rs (100%) rename crates/ide-vcs/tests/{ => integration}/log_lock.rs (99%) rename crates/ide-vcs/tests/{ => integration}/log_projection.rs (100%) rename crates/ide-vcs/tests/{ => integration}/log_shape.rs (100%) create mode 100644 crates/ide-vcs/tests/integration/main.rs rename crates/ide-vcs/tests/{ => integration}/partial_clone.rs (100%) rename crates/ide-vcs/tests/{ => integration}/repo.rs (100%) rename crates/ide-vcs/tests/{ => integration}/stash_paths.rs (100%) rename crates/ide-vcs/tests/{ => integration}/submodule_update.rs (100%) rename crates/ide-vcs/tests/{ => integration}/volume_loss.rs (99%) rename crates/ide-workspace/tests/{ => integration}/documents.rs (100%) rename crates/ide-workspace/tests/{ => integration}/file_operations.rs (100%) create mode 100644 crates/ide-workspace/tests/integration/main.rs rename crates/ide-workspace/tests/{ => integration}/workspace_edits.rs (100%) rename crates/ide-workspace/tests/{ => integration}/write_load_invariant.rs (100%) diff --git a/.config/nextest.toml b/.config/nextest.toml index f0caa8061d..798f8f0b55 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -16,5 +16,5 @@ test-group = "windows-clipboard" # that hangs (a server left stopped) is ended after 5 minutes instead of waiting for svn's own # timeout. [[profile.default.overrides]] -filter = 'package(=ide-svn) | (package(=ide-host) & (binary(=svn) | binary(=ij_svn_roots)))' +filter = 'package(=ide-svn) | (package(=ide-host) & binary(=integration) & (test(/^svn::/) | test(/^ij_svn_roots::/)))' slow-timeout = { period = "60s", terminate-after = 5 } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24f34f76dd..f56f7e64b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,13 +118,6 @@ jobs: runs-on: ${{ matrix.os == 'ubuntu-latest' && vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || matrix.os }} steps: - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 - with: { version: 11 } - - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 - with: - node-version: 22 - cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }} - package-manager-cache: ${{ runner.environment != 'self-hosted' }} - uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca # stable with: { components: "clippy, rustfmt" } # Self-hosted runners keep persistent local Cargo caches; GitHub-hosted runners use Actions cache @@ -169,11 +162,14 @@ jobs: shell: bash run: svn --version --quiet && svnadmin --version --quiet && svnserve --version --quiet && sqlite3 --version # tauri-build checks that frontendDist exists. - - run: pnpm install --frozen-lockfile && mkdir -p dist + - run: mkdir -p dist shell: bash - if: runner.os == 'Linux' run: cargo fmt --all --check - - run: cargo clippy --workspace --all-targets -- -D warnings + # On PRs, run clippy on Linux only; macOS/Windows still compile and test all targets + # via nextest, and run clippy on main/merge_group so platform-only lints are still caught. + - if: runner.os == 'Linux' || github.event_name != 'pull_request' + run: cargo clippy --workspace --all-targets -- -D warnings # Test fixtures write LF files; keep Git from converting them on checkout. - run: git config --global core.autocrlf false - name: Restore Maven artifacts for Java build tests @@ -257,7 +253,7 @@ jobs: docker pull busybox:latest # --workspace, not -p ide-host: -p would rebuild instead of reusing the test build above. cargo nextest run --workspace --run-ignored only \ - -E 'package(=ide-host) & binary(=remote_daemon) & test(=compose_service_survives_disconnect_and_is_removed_on_stop)' + -E 'package(=ide-host) & binary(=integration) & test(=remote_daemon::compose_service_survives_disconnect_and_is_removed_on_stop)' # nextest skips doctests; ide-command's are its compile-fail tests. - if: runner.os == 'Linux' run: cargo test --doc -p ide-command @@ -296,7 +292,9 @@ jobs: with: { targets: x86_64-unknown-linux-musl } - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 if: runner.environment != 'self-hosted' - with: { key: server-musl } + with: + key: server-musl + save-if: ${{ github.ref == 'refs/heads/main' }} - name: Persistent Cargo target dir if: runner.environment == 'self-hosted' shell: bash diff --git a/.github/workflows/language-smoke.yml b/.github/workflows/language-smoke.yml index 9e3312d97c..b24240ddb2 100644 --- a/.github/workflows/language-smoke.yml +++ b/.github/workflows/language-smoke.yml @@ -26,6 +26,9 @@ on: - "src/features/build/**" - "src/features/build-tools/**" - "src/platform/**" + - "!src/platform/locales/text/**" + - "!src/platform/locales/*.json" + - "src/platform/locales/en.json" - "src/workbench/**" - "src/ui/**" - "src/editor/api.ts" @@ -89,6 +92,7 @@ jobs: pull-requests: read outputs: languages: ${{ steps.classify.outputs.languages }} + groups: ${{ steps.classify.outputs.groups }} steps: - id: classify env: @@ -98,8 +102,18 @@ jobs: set -euo pipefail all="typescript python rust go java kotlin php c cpp" emit() { tr ' ' '\n' <<< "$1" | { grep . || true; } | sort -u | jq -Rsc 'split("\n") | map(select(. != ""))'; } + emit_groups() { + jq -nc --argjson langs "$1" ' + [ + { name: "jvm", languages: ($langs | map(select(. == "java" or . == "kotlin"))) }, + { name: "systems", languages: ($langs | map(select(. == "rust" or . == "go" or . == "c" or . == "cpp"))) }, + { name: "scripting", languages: ($langs | map(select(. == "typescript" or . == "python" or . == "php"))) } + ] | map(select(.languages | length > 0))' + } if [ "$GITHUB_EVENT_NAME" != pull_request ]; then - echo "languages=$(emit "$all")" | tee -a "$GITHUB_OUTPUT" + langs_json=$(emit "$all") + echo "languages=$langs_json" | tee -a "$GITHUB_OUTPUT" + echo "groups=$(emit_groups "$langs_json")" | tee -a "$GITHUB_OUTPUT" exit 0 fi gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR/files" \ @@ -108,8 +122,9 @@ jobs: # Crates outside what the smoke runs (language servers, debuggers, run configurations, # SDKs, build tools, the project model, Find Usages candidates, debug stream traces): # cargo metadata, ide-host's direct deps ide-search/ide-streams and the deps of - # ide-lsp/dap/run/sdk/tools. - unused='^crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-spell|ide-ssh|ide-vcs|ide-web)/' + # ide-lsp/dap/run/sdk/tools. Also skip non-English lazy locale catalogs (smoke always + # runs in the default English locale). + unused='^(crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-spell|ide-ssh|ide-vcs|ide-web)/|src/platform/locales/text/)' # The workflow's paths, less those handled per language below. smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|navigationProviders|refactorProviders|relatedProviders|core/cm/(cornerInset|iconArea|inlineBg|lineNumberOptions|localAppearance)|lsp/(availability|diagnostics|files|hint|lsp|positions|snippet))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src/assets/openidea-logo\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)' langs="" @@ -117,6 +132,8 @@ jobs: case "$f" in crates/ide-host/tests/language_smoke.rs | crates/ide-host/tests/project_smoke.rs) langs="$all"; break ;; crates/*/tests/* | crates/*/benches/*) ;; + src/platform/locales/en.json) langs="$all"; break ;; + src/platform/locales/*.json) ;; fixtures/ts-app/*) langs+=" typescript" ;; fixtures/python-app/*) langs+=" python" ;; fixtures/rust-app/*) langs+=" rust" ;; @@ -141,7 +158,9 @@ jobs: *) if grep -Eq "$smoke" <<< "$f" && ! grep -Eq "$unused" <<< "$f"; then langs="$all"; break; fi ;; esac done < files.txt - echo "languages=$(emit "$langs")" | tee -a "$GITHUB_OUTPUT" + langs_json=$(emit "$langs") + echo "languages=$langs_json" | tee -a "$GITHUB_OUTPUT" + echo "groups=$(emit_groups "$langs_json")" | tee -a "$GITHUB_OUTPUT" # Builds the smoke test binaries and openidea-server once for every language below. build: @@ -190,12 +209,12 @@ jobs: with: { name: smoke-bin, path: smoke-bin.tar, retention-days: 1 } smoke: - name: Language smoke (${{ matrix.language }}) + name: Language smoke (${{ matrix.group.name }}) needs: [changes, build] strategy: fail-fast: false matrix: - language: ${{ fromJSON(needs.changes.outputs.languages) }} + group: ${{ fromJSON(needs.changes.outputs.groups) }} # Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the # SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online. runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }} @@ -208,7 +227,8 @@ jobs: - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 # Tool versions, shared with the evals (pnpm eval). - run: grep -E '^[A-Z0-9_]+=' .github/tool-versions.env >> "$GITHUB_ENV" - - uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca # stable + - if: contains(matrix.group.languages, 'rust') + uses: dtolnay/rust-toolchain@39008827e6b4319a349e9a42dfc90579dd25f1ca # stable with: { components: "rust-analyzer, rustfmt" } - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 with: { name: smoke-bin } @@ -223,11 +243,11 @@ jobs: node-version: 22 cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }} package-manager-cache: ${{ runner.environment != 'self-hosted' }} - - if: matrix.language == 'typescript' + - if: contains(matrix.group.languages, 'typescript') run: npm install --global "@vtsls/language-server@$VTSLS" "typescript@$TYPESCRIPT" # The smoke checks C/C++ with clangd and debugs c-app with GDB's own DAP interpreter (GDB 14+). - - if: matrix.language == 'c' || matrix.language == 'cpp' + - if: contains(matrix.group.languages, 'c') || contains(matrix.group.languages, 'cpp') shell: bash run: | pkgs=() @@ -243,22 +263,22 @@ jobs: exit 1 fi - - if: matrix.language == 'python' + - if: contains(matrix.group.languages, 'python') uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: { python-version: "3.12" } - - if: matrix.language == 'python' + - if: contains(matrix.group.languages, 'python') run: pip install "basedpyright==$BASEDPYRIGHT" "ruff==$RUFF" - - if: matrix.language == 'go' + - if: contains(matrix.group.languages, 'go') uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: { go-version: "1.27", cache: false } - - if: matrix.language == 'go' + - if: contains(matrix.group.languages, 'go') run: go install "golang.org/x/tools/gopls@$GOPLS" - - if: matrix.language == 'java' || matrix.language == 'kotlin' + - if: contains(matrix.group.languages, 'java') || contains(matrix.group.languages, 'kotlin') uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1 with: { distribution: temurin, java-version: "${{ env.JAVA }}" } - - if: matrix.language == 'java' + - if: contains(matrix.group.languages, 'java') run: | command -v mvn >/dev/null || { sudo apt-get update && sudo apt-get install -y maven; } mkdir -p "$RUNNER_TEMP/jdtls" @@ -267,10 +287,12 @@ jobs: echo "$RUNNER_TEMP/jdtls/bin" >> "$GITHUB_PATH" # The Kotlin fixture has no Gradle wrapper: the server imports it with the Gradle on PATH. - - if: matrix.language == 'kotlin' + - if: contains(matrix.group.languages, 'kotlin') uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3 - with: { gradle-version: "${{ env.GRADLE }}" } - - if: matrix.language == 'kotlin' + with: + gradle-version: "${{ env.GRADLE }}" + cache-read-only: ${{ github.ref != 'refs/heads/main' }} + - if: contains(matrix.group.languages, 'kotlin') run: | mkdir -p "$RUNNER_TEMP/kotlin-lsp" "$RUNNER_TEMP/bin" curl -fsSL "https://download.jetbrains.com/language-server/kotlin-server/$KOTLIN_LSP/kotlin-server-$KOTLIN_LSP.tar.gz" \ @@ -279,31 +301,48 @@ jobs: echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" # Xdebug for the debug smoke; Composer installs the fixture's Pest for the run smoke. - - if: matrix.language == 'php' + - if: contains(matrix.group.languages, 'php') uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 with: { php-version: "8.5", coverage: xdebug, tools: composer } - - if: matrix.language == 'php' + - if: contains(matrix.group.languages, 'php') run: npm install --global "intelephense@$INTELEPHENSE" # The binaries from the build job, run from the crate directory as `cargo test` does. - - working-directory: crates/ide-host - run: ../../smoke-bin/language_smoke --ignored --exact ${{ matrix.language }} - # Problems › TypeScript Project Errors runs the project's own tsc: the global install stands in. - - if: matrix.language == 'typescript' + - name: Code intelligence and project smoke working-directory: crates/ide-host - run: ../../smoke-bin/language_smoke --ignored --exact typescript_project_errors typescript_import_style - - if: matrix.language == 'java' - working-directory: crates/ide-host - run: ../../smoke-bin/project_smoke --ignored --exact maven_sync jdk maven_launch_classpath_uses_the_runner_jdk_classifier - - if: matrix.language == 'kotlin' - working-directory: crates/ide-host - run: ../../smoke-bin/project_smoke --ignored --exact gradle_sync - - if: matrix.language == 'python' - working-directory: crates/ide-host - run: ../../smoke-bin/project_smoke --ignored --exact python_venv + shell: bash + run: | + set -euo pipefail + status=0 + for lang in ${{ join(matrix.group.languages, ' ') }}; do + echo "::group::language_smoke ($lang)" + ../../smoke-bin/language_smoke --ignored --exact "$lang" || status=1 + # Problems › TypeScript Project Errors runs the project's own tsc: the global install stands in. + if [ "$lang" = typescript ]; then + ../../smoke-bin/language_smoke --ignored --exact typescript_project_errors typescript_import_style || status=1 + fi + if [ "$lang" = java ]; then + ../../smoke-bin/project_smoke --ignored --exact maven_sync jdk maven_launch_classpath_uses_the_runner_jdk_classifier || status=1 + fi + if [ "$lang" = kotlin ]; then + ../../smoke-bin/project_smoke --ignored --exact gradle_sync || status=1 + fi + if [ "$lang" = python ]; then + ../../smoke-bin/project_smoke --ignored --exact python_venv || status=1 + fi + echo "::endgroup::" + done + exit "$status" - run: pnpm install --frozen-lockfile - - run: pnpm smoke smoke/run.test.ts -t "^${{ matrix.language }}$" - - run: pnpm smoke smoke/debug.test.ts -t "^${{ matrix.language }}$" + - name: Run and debug smoke + shell: bash # The IDE installs the debugger from GitHub releases: authenticated, against rate limits. env: { GITHUB_TOKEN: "${{ github.token }}" } + run: | + set -euo pipefail + pattern="^($(echo "${{ join(matrix.group.languages, '|') }}"))$" + status=0 + pnpm smoke smoke/run.test.ts -t "$pattern" || status=1 + pnpm smoke smoke/debug.test.ts -t "$pattern" || status=1 + exit "$status" diff --git a/crates/ide-dap/tests/debugpy.rs b/crates/ide-dap/tests/integration/debugpy.rs similarity index 100% rename from crates/ide-dap/tests/debugpy.rs rename to crates/ide-dap/tests/integration/debugpy.rs diff --git a/crates/ide-dap/tests/godot.rs b/crates/ide-dap/tests/integration/godot.rs similarity index 100% rename from crates/ide-dap/tests/godot.rs rename to crates/ide-dap/tests/integration/godot.rs diff --git a/crates/ide-dap/tests/integration/main.rs b/crates/ide-dap/tests/integration/main.rs new file mode 100644 index 0000000000..55b5a8b98a --- /dev/null +++ b/crates/ide-dap/tests/integration/main.rs @@ -0,0 +1,6 @@ +mod debugpy; +mod godot; +mod php_debug; +mod real_adapters; +mod script_debuggers; +mod unity; diff --git a/crates/ide-dap/tests/php_debug.rs b/crates/ide-dap/tests/integration/php_debug.rs similarity index 100% rename from crates/ide-dap/tests/php_debug.rs rename to crates/ide-dap/tests/integration/php_debug.rs diff --git a/crates/ide-dap/tests/real_adapters.rs b/crates/ide-dap/tests/integration/real_adapters.rs similarity index 100% rename from crates/ide-dap/tests/real_adapters.rs rename to crates/ide-dap/tests/integration/real_adapters.rs diff --git a/crates/ide-dap/tests/script_debuggers.rs b/crates/ide-dap/tests/integration/script_debuggers.rs similarity index 100% rename from crates/ide-dap/tests/script_debuggers.rs rename to crates/ide-dap/tests/integration/script_debuggers.rs diff --git a/crates/ide-dap/tests/unity.rs b/crates/ide-dap/tests/integration/unity.rs similarity index 100% rename from crates/ide-dap/tests/unity.rs rename to crates/ide-dap/tests/integration/unity.rs diff --git a/crates/ide-db/tests/clickhouse.rs b/crates/ide-db/tests/integration/clickhouse.rs similarity index 100% rename from crates/ide-db/tests/clickhouse.rs rename to crates/ide-db/tests/integration/clickhouse.rs diff --git a/crates/ide-db/tests/jdbc.rs b/crates/ide-db/tests/integration/jdbc.rs similarity index 100% rename from crates/ide-db/tests/jdbc.rs rename to crates/ide-db/tests/integration/jdbc.rs diff --git a/crates/ide-db/tests/integration/main.rs b/crates/ide-db/tests/integration/main.rs new file mode 100644 index 0000000000..9ad25080c6 --- /dev/null +++ b/crates/ide-db/tests/integration/main.rs @@ -0,0 +1,11 @@ +mod clickhouse; +mod jdbc; +mod mysql; +mod pg_console_sessions; +mod pg_console_transactions; +mod postgres; +mod snowflake; +mod sqlite; +mod sqlite_console_sessions; +mod sqlserver; +mod ssh_tunnel; diff --git a/crates/ide-db/tests/mysql.rs b/crates/ide-db/tests/integration/mysql.rs similarity index 100% rename from crates/ide-db/tests/mysql.rs rename to crates/ide-db/tests/integration/mysql.rs diff --git a/crates/ide-db/tests/pg_console_sessions.rs b/crates/ide-db/tests/integration/pg_console_sessions.rs similarity index 100% rename from crates/ide-db/tests/pg_console_sessions.rs rename to crates/ide-db/tests/integration/pg_console_sessions.rs diff --git a/crates/ide-db/tests/pg_console_transactions.rs b/crates/ide-db/tests/integration/pg_console_transactions.rs similarity index 100% rename from crates/ide-db/tests/pg_console_transactions.rs rename to crates/ide-db/tests/integration/pg_console_transactions.rs diff --git a/crates/ide-db/tests/postgres.rs b/crates/ide-db/tests/integration/postgres.rs similarity index 99% rename from crates/ide-db/tests/postgres.rs rename to crates/ide-db/tests/integration/postgres.rs index bb8e049246..8e235cb656 100644 --- a/crates/ide-db/tests/postgres.rs +++ b/crates/ide-db/tests/integration/postgres.rs @@ -701,7 +701,7 @@ async fn managed_tunnel_shares_the_forwarder_and_closes_it_after_the_last_target executable: std::env::current_exe()?.to_string_lossy().into_owned(), arguments: vec![ "--exact".into(), - "postgres_tunnel_fixture".into(), + "postgres::postgres_tunnel_fixture".into(), "--skip".into(), "listen={localPort}".into(), "--skip".into(), @@ -758,7 +758,7 @@ async fn external_startup_does_not_block_another_source_and_disconnect_cancels_i executable: std::env::current_exe()?.to_string_lossy().into_owned(), arguments: vec![ "--exact".into(), - "postgres_tunnel_fixture".into(), + "postgres::postgres_tunnel_fixture".into(), "--skip".into(), "listen={localPort}".into(), "--skip".into(), diff --git a/crates/ide-db/tests/snowflake.rs b/crates/ide-db/tests/integration/snowflake.rs similarity index 99% rename from crates/ide-db/tests/snowflake.rs rename to crates/ide-db/tests/integration/snowflake.rs index c5bf12463a..3161cb82f5 100644 --- a/crates/ide-db/tests/snowflake.rs +++ b/crates/ide-db/tests/integration/snowflake.rs @@ -320,7 +320,7 @@ async fn explorer_metadata_against_a_real_account() { // each is either answered or refused by Snowflake (an edition or privilege it needs), never // misread by the client. `USE` goes to what the session already has. let fixture: serde_json::Value = - serde_json::from_str(include_str!("fixtures/snowflake/commands.json")).expect("the fixture parses"); + serde_json::from_str(include_str!("../fixtures/snowflake/commands.json")).expect("the fixture parses"); let mut statements: Vec<(String, String)> = fixture["commands"] .as_array() .expect("commands") diff --git a/crates/ide-db/tests/sqlite.rs b/crates/ide-db/tests/integration/sqlite.rs similarity index 100% rename from crates/ide-db/tests/sqlite.rs rename to crates/ide-db/tests/integration/sqlite.rs diff --git a/crates/ide-db/tests/sqlite_console_sessions.rs b/crates/ide-db/tests/integration/sqlite_console_sessions.rs similarity index 100% rename from crates/ide-db/tests/sqlite_console_sessions.rs rename to crates/ide-db/tests/integration/sqlite_console_sessions.rs diff --git a/crates/ide-db/tests/sqlserver.rs b/crates/ide-db/tests/integration/sqlserver.rs similarity index 100% rename from crates/ide-db/tests/sqlserver.rs rename to crates/ide-db/tests/integration/sqlserver.rs diff --git a/crates/ide-db/tests/ssh_tunnel.rs b/crates/ide-db/tests/integration/ssh_tunnel.rs similarity index 100% rename from crates/ide-db/tests/ssh_tunnel.rs rename to crates/ide-db/tests/integration/ssh_tunnel.rs diff --git a/crates/ide-host/tests/agent_approvals.rs b/crates/ide-host/tests/integration/agent_approvals.rs similarity index 99% rename from crates/ide-host/tests/agent_approvals.rs rename to crates/ide-host/tests/integration/agent_approvals.rs index 7ad2bf329b..2dfceb40c8 100644 --- a/crates/ide-host/tests/agent_approvals.rs +++ b/crates/ide-host/tests/integration/agent_approvals.rs @@ -1,6 +1,6 @@ //! The mode new agent tasks start in. -mod common; +use crate::common; use ide_host::{Host, HostConfig}; use serde_json::json; diff --git a/crates/ide-host/tests/agent_automations.rs b/crates/ide-host/tests/integration/agent_automations.rs similarity index 99% rename from crates/ide-host/tests/agent_automations.rs rename to crates/ide-host/tests/integration/agent_automations.rs index 8a207cc6bc..6449e79284 100644 --- a/crates/ide-host/tests/agent_automations.rs +++ b/crates/ide-host/tests/integration/agent_automations.rs @@ -4,7 +4,7 @@ //! worktree auto-GC + retention cap, `NeedsInput` approval, in-session `Send Later` / `/loop`, //! and persistent `openidea-server --daemon` keep-alive across disconnects. -mod common; +use crate::common; use ide_agent::{ AgentPrompt, AutomationContinuity, AutomationPermissionMode, AutomationRunOrigin, AutomationRunStatus, diff --git a/crates/ide-host/tests/agent_env_secrets.rs b/crates/ide-host/tests/integration/agent_env_secrets.rs similarity index 99% rename from crates/ide-host/tests/agent_env_secrets.rs rename to crates/ide-host/tests/integration/agent_env_secrets.rs index 684f9b785e..a1c98c69bb 100644 --- a/crates/ide-host/tests/agent_env_secrets.rs +++ b/crates/ide-host/tests/integration/agent_env_secrets.rs @@ -1,6 +1,6 @@ //! Values of agents' environment variables live in the credential store; agent files keep only their names. -mod common; +use crate::common; use ide_host::Host; use ide_ssh::secrets::testing::{files_containing, use_memory_store}; diff --git a/crates/ide-host/tests/agent_mcp.rs b/crates/ide-host/tests/integration/agent_mcp.rs similarity index 99% rename from crates/ide-host/tests/agent_mcp.rs rename to crates/ide-host/tests/integration/agent_mcp.rs index 766e3c6e77..6ecdb63ad9 100644 --- a/crates/ide-host/tests/agent_mcp.rs +++ b/crates/ide-host/tests/integration/agent_mcp.rs @@ -1,6 +1,6 @@ //! External MCP servers in Settings › Agents, as the host stores and lists them. -mod common; +use crate::common; use ide_agent::{McpScope, McpServer, McpServerInput}; use ide_core::settings::McpTransport; diff --git a/crates/ide-host/tests/agent_model_refresh.rs b/crates/ide-host/tests/integration/agent_model_refresh.rs similarity index 99% rename from crates/ide-host/tests/agent_model_refresh.rs rename to crates/ide-host/tests/integration/agent_model_refresh.rs index a16cf58f46..b59d3cfda3 100644 --- a/crates/ide-host/tests/agent_model_refresh.rs +++ b/crates/ide-host/tests/integration/agent_model_refresh.rs @@ -1,7 +1,6 @@ //! Separate project windows share discovery and its backend-enforced cooldown. -#![cfg(unix)] -mod common; +use crate::common; use ide_agent::AgentEvent; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/attached_excludes.rs b/crates/ide-host/tests/integration/attached_excludes.rs similarity index 99% rename from crates/ide-host/tests/attached_excludes.rs rename to crates/ide-host/tests/integration/attached_excludes.rs index 51d4a63d95..55883ffd4a 100644 --- a/crates/ide-host/tests/attached_excludes.rs +++ b/crates/ide-host/tests/integration/attached_excludes.rs @@ -1,5 +1,5 @@ //! Each project of a workspace keeps its own excluded folders: they apply below that project only. -mod common; +use crate::common; use ide_core::RequestId; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/binary_args.rs b/crates/ide-host/tests/integration/binary_args.rs similarity index 99% rename from crates/ide-host/tests/binary_args.rs rename to crates/ide-host/tests/integration/binary_args.rs index 79b3443945..5355cc1dcc 100644 --- a/crates/ide-host/tests/binary_args.rs +++ b/crates/ide-host/tests/integration/binary_args.rs @@ -1,6 +1,6 @@ //! Binary command arguments over the remote protocol: base64 strings, not arrays of numbers. -mod common; +use crate::common; use ide_core::IpcBytes; use ide_host::Host; diff --git a/crates/ide-host/tests/close_project.rs b/crates/ide-host/tests/integration/close_project.rs similarity index 99% rename from crates/ide-host/tests/close_project.rs rename to crates/ide-host/tests/integration/close_project.rs index 59db0fbef6..da70372f9f 100644 --- a/crates/ide-host/tests/close_project.rs +++ b/crates/ide-host/tests/integration/close_project.rs @@ -1,8 +1,7 @@ //! Closing a project takes the background processes of its window with it, as IDEA does, //! and leaves the other windows' processes alone. -#![cfg(unix)] -mod common; +use crate::common; use ide_host::{Host, ops}; use std::sync::Arc; diff --git a/crates/ide-host/tests/container_php_real.rs b/crates/ide-host/tests/integration/container_php_real.rs similarity index 99% rename from crates/ide-host/tests/container_php_real.rs rename to crates/ide-host/tests/integration/container_php_real.rs index 7c54432b41..a9114579f3 100644 --- a/crates/ide-host/tests/container_php_real.rs +++ b/crates/ide-host/tests/integration/container_php_real.rs @@ -1,7 +1,7 @@ //! The PHP of a Docker and of a Compose run target, against a real daemon. Ignored by default: //! `docker` with the Compose plugin must be on `PATH` and able to pull `php:8.3-cli`. -mod common; +use crate::common; use ide_host::{Host, ops}; use std::sync::Arc; diff --git a/crates/ide-host/tests/container_python_real.rs b/crates/ide-host/tests/integration/container_python_real.rs similarity index 99% rename from crates/ide-host/tests/container_python_real.rs rename to crates/ide-host/tests/integration/container_python_real.rs index 7da78f8e12..fd6312efe3 100644 --- a/crates/ide-host/tests/container_python_real.rs +++ b/crates/ide-host/tests/integration/container_python_real.rs @@ -3,9 +3,8 @@ //! daemon can bind-mount (on this machine, or at the same path in a VM such as OrbStack's), //! `docker` with the Compose plugin and `basedpyright-langserver` must be on `PATH`, and //! this machine's Python must not have Django installed. -#![cfg(unix)] -mod common; +use crate::common; use ide_core::IdeEvent; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/csharpier.rs b/crates/ide-host/tests/integration/csharpier.rs similarity index 99% rename from crates/ide-host/tests/csharpier.rs rename to crates/ide-host/tests/integration/csharpier.rs index 0abdf9e558..275a767e96 100644 --- a/crates/ide-host/tests/csharpier.rs +++ b/crates/ide-host/tests/integration/csharpier.rs @@ -2,7 +2,7 @@ //! It downloads CSharpier, so it runs only on request: //! `cargo test -p ide-host --test csharpier -- --ignored`; skipped without a .NET SDK. -mod common; +use crate::common; use ide_core::error::ErrorKind; use ide_core::{IdeEvent, IdeResult, Pos, Range, TextEdit}; diff --git a/crates/ide-host/tests/data_dirs.rs b/crates/ide-host/tests/integration/data_dirs.rs similarity index 99% rename from crates/ide-host/tests/data_dirs.rs rename to crates/ide-host/tests/integration/data_dirs.rs index efb437ddfa..c2f4bb7fcc 100644 --- a/crates/ide-host/tests/data_dirs.rs +++ b/crates/ide-host/tests/integration/data_dirs.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/db_consoles.rs b/crates/ide-host/tests/integration/db_consoles.rs similarity index 99% rename from crates/ide-host/tests/db_consoles.rs rename to crates/ide-host/tests/integration/db_consoles.rs index 6243d700a0..7be5899657 100644 --- a/crates/ide-host/tests/db_consoles.rs +++ b/crates/ide-host/tests/integration/db_consoles.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_host::Host; use ide_host::ops::db; diff --git a/crates/ide-host/tests/debug_jvm_memory_ipc.rs b/crates/ide-host/tests/integration/debug_jvm_memory_ipc.rs similarity index 99% rename from crates/ide-host/tests/debug_jvm_memory_ipc.rs rename to crates/ide-host/tests/integration/debug_jvm_memory_ipc.rs index b137e96b85..6acee4cc3f 100644 --- a/crates/ide-host/tests/debug_jvm_memory_ipc.rs +++ b/crates/ide-host/tests/integration/debug_jvm_memory_ipc.rs @@ -2,7 +2,7 @@ //! that sends no real window (the desktop shell once passed `""`) never reaches the debugger, //! and a project in Restricted Mode never reads the debuggee's memory. -mod common; +use crate::common; use ide_core::IdeError; use ide_host::Host; diff --git a/crates/ide-host/tests/directory_sync.rs b/crates/ide-host/tests/integration/directory_sync.rs similarity index 99% rename from crates/ide-host/tests/directory_sync.rs rename to crates/ide-host/tests/integration/directory_sync.rs index 32478757a5..c1316a793e 100644 --- a/crates/ide-host/tests/directory_sync.rs +++ b/crates/ide-host/tests/integration/directory_sync.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::RequestId; use ide_host::{ diff --git a/crates/ide-host/tests/distribution.rs b/crates/ide-host/tests/integration/distribution.rs similarity index 100% rename from crates/ide-host/tests/distribution.rs rename to crates/ide-host/tests/integration/distribution.rs diff --git a/crates/ide-host/tests/docker_run_targets_real.rs b/crates/ide-host/tests/integration/docker_run_targets_real.rs similarity index 99% rename from crates/ide-host/tests/docker_run_targets_real.rs rename to crates/ide-host/tests/integration/docker_run_targets_real.rs index 81c12b3a58..e942bf7bd6 100644 --- a/crates/ide-host/tests/docker_run_targets_real.rs +++ b/crates/ide-host/tests/integration/docker_run_targets_real.rs @@ -2,9 +2,8 @@ //! `OPENIDEA_DOCKER_TEST_DIR` names an empty folder the daemon can bind-mount //! (on this machine, or at the same path in a VM such as OrbStack's), and //! `docker` with the Compose plugin must be on `PATH`. -#![cfg(unix)] -mod common; +use crate::common; use ide_host::{Host, ops}; use ide_run::{OutputChunk, RunConfig}; diff --git a/crates/ide-host/tests/external_log.rs b/crates/ide-host/tests/integration/external_log.rs similarity index 99% rename from crates/ide-host/tests/external_log.rs rename to crates/ide-host/tests/integration/external_log.rs index 9c9786ac20..d8ba02bd68 100644 --- a/crates/ide-host/tests/external_log.rs +++ b/crates/ide-host/tests/integration/external_log.rs @@ -1,5 +1,5 @@ //! Explicit external logs allow history reads without adding a writable project root. -mod common; +use crate::common; use ide_host::{Host, ops::vcs}; use std::{path::Path, process::Command}; diff --git a/crates/ide-host/tests/gradle_linkage.rs b/crates/ide-host/tests/integration/gradle_linkage.rs similarity index 99% rename from crates/ide-host/tests/gradle_linkage.rs rename to crates/ide-host/tests/integration/gradle_linkage.rs index d547ed7d6f..e086d343d9 100644 --- a/crates/ide-host/tests/gradle_linkage.rs +++ b/crates/ide-host/tests/integration/gradle_linkage.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/ij_svn_roots.rs b/crates/ide-host/tests/integration/ij_svn_roots.rs similarity index 99% rename from crates/ide-host/tests/ij_svn_roots.rs rename to crates/ide-host/tests/integration/ij_svn_roots.rs index 20df7fea06..b1cdf2e9bb 100644 --- a/crates/ide-host/tests/ij_svn_roots.rs +++ b/crates/ide-host/tests/integration/ij_svn_roots.rs @@ -3,7 +3,7 @@ //! SvnExternalTest, SvnExternalCommitNoticedTest and SvnCommitTest (scenarios only); the //! working copies themselves are checked in crates/ide-svn/tests/ij_files.rs. //! Skipped when `svn` or `svnadmin` is not installed (a failure in CI). -mod common; +use crate::common; use ide_host::Host; use ide_host::ops::vcs; diff --git a/crates/ide-host/tests/java_build.rs b/crates/ide-host/tests/integration/java_build.rs similarity index 95% rename from crates/ide-host/tests/java_build.rs rename to crates/ide-host/tests/integration/java_build.rs index 4145088d2a..0af1dd5c99 100644 --- a/crates/ide-host/tests/java_build.rs +++ b/crates/ide-host/tests/integration/java_build.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_build::compile::BuildEvent; use ide_core::RequestId; @@ -26,11 +26,11 @@ async fn pom_launch_uses_dependency_classpath_without_a_java_project() { let temp = tempfile::tempdir().unwrap(); let base = dunce::canonicalize(temp.path()).unwrap(); let root = base.join("project"); - let pom = include_str!("../../ide-build/tests/fixtures/jbuild-maven/pom.xml") + let pom = include_str!("../../../ide-build/tests/fixtures/jbuild-maven/pom.xml") .replace("", "assembly"); write(&root, "pom.xml", &pom); - write(&root, "lib/pom.xml", include_str!("../../ide-build/tests/fixtures/jbuild-maven/lib/pom.xml")); - write(&root, "app/pom.xml", include_str!("../../ide-build/tests/fixtures/jbuild-maven/app/pom.xml")); + write(&root, "lib/pom.xml", include_str!("../../../ide-build/tests/fixtures/jbuild-maven/lib/pom.xml")); + write(&root, "app/pom.xml", include_str!("../../../ide-build/tests/fixtures/jbuild-maven/app/pom.xml")); write( &root, "assembly/pom.xml", @@ -130,9 +130,9 @@ async fn maven_launch_compiles_with_the_ides_java_build() { let temp = tempfile::tempdir().unwrap(); let base = dunce::canonicalize(temp.path()).unwrap(); let root = base.join("project"); - write(&root, "pom.xml", include_str!("../../ide-build/tests/fixtures/jbuild-maven/pom.xml")); - write(&root, "lib/pom.xml", include_str!("../../ide-build/tests/fixtures/jbuild-maven/lib/pom.xml")); - write(&root, "app/pom.xml", include_str!("../../ide-build/tests/fixtures/jbuild-maven/app/pom.xml")); + write(&root, "pom.xml", include_str!("../../../ide-build/tests/fixtures/jbuild-maven/pom.xml")); + write(&root, "lib/pom.xml", include_str!("../../../ide-build/tests/fixtures/jbuild-maven/lib/pom.xml")); + write(&root, "app/pom.xml", include_str!("../../../ide-build/tests/fixtures/jbuild-maven/app/pom.xml")); write( &root, "lib/src/main/java/l/L.java", diff --git a/crates/ide-host/tests/jdtls_excluded_checkout.rs b/crates/ide-host/tests/integration/jdtls_excluded_checkout.rs similarity index 100% rename from crates/ide-host/tests/jdtls_excluded_checkout.rs rename to crates/ide-host/tests/integration/jdtls_excluded_checkout.rs diff --git a/crates/ide-host/tests/light_edit.rs b/crates/ide-host/tests/integration/light_edit.rs similarity index 99% rename from crates/ide-host/tests/light_edit.rs rename to crates/ide-host/tests/integration/light_edit.rs index 5ff84092a6..decabdb2d1 100644 --- a/crates/ide-host/tests/light_edit.rs +++ b/crates/ide-host/tests/integration/light_edit.rs @@ -1,6 +1,6 @@ //! LightEdit: a window editing loose files without a project. -mod common; +use crate::common; use ide_core::{ChangeSet, Pos, Range, SymbolKind, TextChange}; use ide_host::{Host, catalogue::TrustClass, ops}; diff --git a/crates/ide-host/tests/integration/main.rs b/crates/ide-host/tests/integration/main.rs new file mode 100644 index 0000000000..7b176b8039 --- /dev/null +++ b/crates/ide-host/tests/integration/main.rs @@ -0,0 +1,101 @@ +#[path = "../common/mod.rs"] +mod common; + +mod agent_approvals; +mod agent_automations; +mod agent_env_secrets; +mod agent_mcp; +#[cfg(unix)] +mod agent_model_refresh; +mod attached_excludes; +mod binary_args; +#[cfg(unix)] +mod close_project; +mod container_php_real; +#[cfg(unix)] +mod container_python_real; +mod csharpier; +mod data_dirs; +mod db_consoles; +mod debug_jvm_memory_ipc; +mod directory_sync; +mod distribution; +#[cfg(unix)] +mod docker_run_targets_real; +mod external_log; +mod gradle_linkage; +mod ij_svn_roots; +mod java_build; +mod jdtls_excluded_checkout; +mod light_edit; +mod maven_external; +mod mcp; +mod mcp_secrets; +mod nav_inheritance; +#[cfg(windows)] +mod network_images; +mod open_project; +mod plugin_clipboard; +mod plugin_code_semantics; +mod plugin_commit; +mod plugin_completion_list; +mod plugin_completion_resolve; +mod plugin_data_tools; +mod plugin_database_open; +mod plugin_dependencies; +mod plugin_diagnostics; +mod plugin_hover; +mod plugin_indexing; +mod plugin_inlay_hints; +mod plugin_language_features; +mod plugin_project_view; +mod plugin_refactoring; +mod plugin_rename; +mod plugin_run_anything; +mod plugin_run_output; +mod plugin_semantic_tokens; +mod plugin_server_commands; +mod plugin_symbols; +mod plugin_syntax_decorations; +mod plugin_view_badge; +mod plugin_watch_paths; +mod plugin_workbench; +mod pom_encoding; +mod properties; +mod pytest_fixtures; +mod python_move; +mod python_rename_comments; +mod python_signature; +mod python_signature_ops; +#[cfg(unix)] +mod remote_daemon; +#[cfg(unix)] +mod remote_plugins; +mod replace_all; +mod roslyn_editorconfig; +mod roslyn_hints; +mod rpc; +mod run_configs; +mod search_encoding; +mod settings_sync; +mod spell_dictionary; +mod ssh_terminal; +mod svn; +#[cfg(any(unix, windows))] +mod terminal_images; +mod trust; +#[cfg(unix)] +mod trust_git_binary; +mod trust_vcs_sweep; +mod unity; +mod vcs_backends; +mod vcs_delete_added; +mod vcs_documents; +mod vcs_encoding; +mod vcs_flow; +mod vcs_roots; +mod vcs_shelf_roots; +mod vcs_watcher_moved_repository; +mod vcs_worktrees; +mod workspace_edits; +mod workspaces; diff --git a/crates/ide-host/tests/maven_external.rs b/crates/ide-host/tests/integration/maven_external.rs similarity index 99% rename from crates/ide-host/tests/maven_external.rs rename to crates/ide-host/tests/integration/maven_external.rs index c53321a62f..efe1ed02c1 100644 --- a/crates/ide-host/tests/maven_external.rs +++ b/crates/ide-host/tests/integration/maven_external.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_host::{Host, HostConfig, ops}; use ide_workspace::settings::SettingsScope; diff --git a/crates/ide-host/tests/mcp.rs b/crates/ide-host/tests/integration/mcp.rs similarity index 99% rename from crates/ide-host/tests/mcp.rs rename to crates/ide-host/tests/integration/mcp.rs index 859e8efba4..da6ac2a296 100644 --- a/crates/ide-host/tests/mcp.rs +++ b/crates/ide-host/tests/integration/mcp.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{ CancellationToken, ChangeSet, Diagnostic, IdeEvent, Pos, Range, Severity, TextChange, event::McpUiRequest, diff --git a/crates/ide-host/tests/mcp_secrets.rs b/crates/ide-host/tests/integration/mcp_secrets.rs similarity index 99% rename from crates/ide-host/tests/mcp_secrets.rs rename to crates/ide-host/tests/integration/mcp_secrets.rs index a146453c9b..7fdaf2f12b 100644 --- a/crates/ide-host/tests/mcp_secrets.rs +++ b/crates/ide-host/tests/integration/mcp_secrets.rs @@ -2,7 +2,7 @@ //! credential store; `settings.toml` keeps only their names. A project's own servers keep //! their values in the project's file, where the project shares them. -mod common; +use crate::common; use ide_agent::{McpKeyValue, McpScope, McpServer, McpServerInput}; use ide_core::settings::McpTransport; diff --git a/crates/ide-host/tests/nav_inheritance.rs b/crates/ide-host/tests/integration/nav_inheritance.rs similarity index 99% rename from crates/ide-host/tests/nav_inheritance.rs rename to crates/ide-host/tests/integration/nav_inheritance.rs index e9caa10f93..5f01861473 100644 --- a/crates/ide-host/tests/nav_inheritance.rs +++ b/crates/ide-host/tests/integration/nav_inheritance.rs @@ -3,7 +3,7 @@ //! written in its source, so the UI can compute inheritance gutter markers without a //! language server's type-hierarchy provider. -mod common; +use crate::common; use ide_host::{Host, ops}; use std::path::PathBuf; diff --git a/crates/ide-host/tests/network_images.rs b/crates/ide-host/tests/integration/network_images.rs similarity index 99% rename from crates/ide-host/tests/network_images.rs rename to crates/ide-host/tests/integration/network_images.rs index 8cf889edd1..23ee18591b 100644 --- a/crates/ide-host/tests/network_images.rs +++ b/crates/ide-host/tests/integration/network_images.rs @@ -2,7 +2,6 @@ //! share signs in to its server with the user's credentials: the host reads an image from a //! share only when a project is open on it. The share here is this machine's own `C$` over //! loopback. -#![cfg(windows)] use ide_core::NullSink; use ide_host::ops::bytes::fs_read_image; diff --git a/crates/ide-host/tests/open_project.rs b/crates/ide-host/tests/integration/open_project.rs similarity index 98% rename from crates/ide-host/tests/open_project.rs rename to crates/ide-host/tests/integration/open_project.rs index d0ae18ec67..2dd39c0c27 100644 --- a/crates/ide-host/tests/open_project.rs +++ b/crates/ide-host/tests/integration/open_project.rs @@ -1,7 +1,7 @@ //! Opening the project a window is already opening reuses it: racing opens (a double //! click, a launch path and a restore) must not start a second index and language servers. -mod common; +use crate::common; use ide_host::Host; use std::sync::{Arc, Barrier}; diff --git a/crates/ide-host/tests/plugin_clipboard.rs b/crates/ide-host/tests/integration/plugin_clipboard.rs similarity index 100% rename from crates/ide-host/tests/plugin_clipboard.rs rename to crates/ide-host/tests/integration/plugin_clipboard.rs diff --git a/crates/ide-host/tests/plugin_code_semantics.rs b/crates/ide-host/tests/integration/plugin_code_semantics.rs similarity index 99% rename from crates/ide-host/tests/plugin_code_semantics.rs rename to crates/ide-host/tests/integration/plugin_code_semantics.rs index f76a10c1de..13bade1ce7 100644 --- a/crates/ide-host/tests/plugin_code_semantics.rs +++ b/crates/ide-host/tests/integration/plugin_code_semantics.rs @@ -1,6 +1,6 @@ //! API 1.21 `code.semantics`: read-only LSP semantic queries require capability & trust //! and confine non-virtual target locations to workspace roots. -mod common; +use crate::common; use ide_core::error::ErrorKind; use ide_host::plugins::{Consent, HostWorkspace, PluginHost}; diff --git a/crates/ide-host/tests/plugin_commit.rs b/crates/ide-host/tests/integration/plugin_commit.rs similarity index 100% rename from crates/ide-host/tests/plugin_commit.rs rename to crates/ide-host/tests/integration/plugin_commit.rs diff --git a/crates/ide-host/tests/plugin_completion_list.rs b/crates/ide-host/tests/integration/plugin_completion_list.rs similarity index 99% rename from crates/ide-host/tests/plugin_completion_list.rs rename to crates/ide-host/tests/integration/plugin_completion_list.rs index 5c1e1a59fb..7c270e0b58 100644 --- a/crates/ide-host/tests/plugin_completion_list.rs +++ b/crates/ide-host/tests/integration/plugin_completion_list.rs @@ -1,6 +1,6 @@ //! API 1.16 `completion-list-provider`: a plugin marks its completion incomplete, and typing on //! in the same word asks that plugin again while the language server's list is kept. -mod common; +use crate::common; use ide_core::{ChangeSet, Pos, RequestId, TextChange}; use ide_host::plugins::{Consent, HostWorkspace, PluginHost, set_editor_providers}; diff --git a/crates/ide-host/tests/plugin_completion_resolve.rs b/crates/ide-host/tests/integration/plugin_completion_resolve.rs similarity index 99% rename from crates/ide-host/tests/plugin_completion_resolve.rs rename to crates/ide-host/tests/integration/plugin_completion_resolve.rs index d1bd9abe63..30dd4372d1 100644 --- a/crates/ide-host/tests/plugin_completion_resolve.rs +++ b/crates/ide-host/tests/integration/plugin_completion_resolve.rs @@ -1,6 +1,6 @@ //! API 1.21 `completion-resolve-provider`: listing items with opaque `data`, capability //! enforcement inside lazy `resolve`, and resolving detail/docs/additional_edits on focus. -mod common; +use crate::common; use ide_core::{Pos, RequestId}; use ide_host::plugins::{Consent, HostWorkspace, PluginHost, set_editor_providers}; diff --git a/crates/ide-host/tests/plugin_data_tools.rs b/crates/ide-host/tests/integration/plugin_data_tools.rs similarity index 99% rename from crates/ide-host/tests/plugin_data_tools.rs rename to crates/ide-host/tests/integration/plugin_data_tools.rs index 0e0200bcc9..42a6bb6e90 100644 --- a/crates/ide-host/tests/plugin_data_tools.rs +++ b/crates/ide-host/tests/integration/plugin_data_tools.rs @@ -1,5 +1,5 @@ //! Database and MCP calls through a real sandboxed component. -mod common; +use crate::common; use ide_core::{CancellationToken, IdeEvent, event::McpUiRequest}; use ide_host::{ diff --git a/crates/ide-host/tests/plugin_database_open.rs b/crates/ide-host/tests/integration/plugin_database_open.rs similarity index 99% rename from crates/ide-host/tests/plugin_database_open.rs rename to crates/ide-host/tests/integration/plugin_database_open.rs index 076a23eb80..7a1aefea23 100644 --- a/crates/ide-host/tests/plugin_database_open.rs +++ b/crates/ide-host/tests/integration/plugin_database_open.rs @@ -1,6 +1,6 @@ //! API 1.21 `database.open-console` & `database.open-table-data`: capability gating, //! unknown source rejection, and OpenDatabaseConsole / OpenDatabaseTable event emission. -mod common; +use crate::common; use ide_core::error::ErrorKind; use ide_host::plugins::{Consent, HostWorkspace, PluginEvent, PluginHost}; diff --git a/crates/ide-host/tests/plugin_dependencies.rs b/crates/ide-host/tests/integration/plugin_dependencies.rs similarity index 100% rename from crates/ide-host/tests/plugin_dependencies.rs rename to crates/ide-host/tests/integration/plugin_dependencies.rs diff --git a/crates/ide-host/tests/plugin_diagnostics.rs b/crates/ide-host/tests/integration/plugin_diagnostics.rs similarity index 99% rename from crates/ide-host/tests/plugin_diagnostics.rs rename to crates/ide-host/tests/integration/plugin_diagnostics.rs index fb71e57aae..d6ce6000ef 100644 --- a/crates/ide-host/tests/plugin_diagnostics.rs +++ b/crates/ide-host/tests/integration/plugin_diagnostics.rs @@ -1,5 +1,5 @@ //! Real Wasm provider dispatch and the document-edit path used locally and over RPC. -mod common; +use crate::common; use ide_core::{CancellationToken, ChangeSet, Diagnostic, IdeEvent, Pos, Range, TextChange}; use ide_host::plugins::{Consent, HostWorkspace, PluginEvent, PluginHost, set_editor_providers}; diff --git a/crates/ide-host/tests/plugin_hover.rs b/crates/ide-host/tests/integration/plugin_hover.rs similarity index 100% rename from crates/ide-host/tests/plugin_hover.rs rename to crates/ide-host/tests/integration/plugin_hover.rs diff --git a/crates/ide-host/tests/plugin_indexing.rs b/crates/ide-host/tests/integration/plugin_indexing.rs similarity index 100% rename from crates/ide-host/tests/plugin_indexing.rs rename to crates/ide-host/tests/integration/plugin_indexing.rs diff --git a/crates/ide-host/tests/plugin_inlay_hints.rs b/crates/ide-host/tests/integration/plugin_inlay_hints.rs similarity index 100% rename from crates/ide-host/tests/plugin_inlay_hints.rs rename to crates/ide-host/tests/integration/plugin_inlay_hints.rs diff --git a/crates/ide-host/tests/plugin_language_features.rs b/crates/ide-host/tests/integration/plugin_language_features.rs similarity index 99% rename from crates/ide-host/tests/plugin_language_features.rs rename to crates/ide-host/tests/integration/plugin_language_features.rs index 69c02ce918..0ef4e24cad 100644 --- a/crates/ide-host/tests/plugin_language_features.rs +++ b/crates/ide-host/tests/integration/plugin_language_features.rs @@ -1,5 +1,5 @@ //! The API 1.4 fixture exercises every kind through the real component runtime and editor ops. -mod common; +use crate::common; use ide_core::{CancellationToken, Pos, Range, RequestId}; use ide_host::plugins::{Consent, HostWorkspace, PluginHost, set_editor_providers}; diff --git a/crates/ide-host/tests/plugin_project_view.rs b/crates/ide-host/tests/integration/plugin_project_view.rs similarity index 99% rename from crates/ide-host/tests/plugin_project_view.rs rename to crates/ide-host/tests/integration/plugin_project_view.rs index a39192bf93..2e0e4ccaf2 100644 --- a/crates/ide-host/tests/plugin_project_view.rs +++ b/crates/ide-host/tests/integration/plugin_project_view.rs @@ -1,5 +1,5 @@ //! API 1.21 Project view panes and Git branch menus, through the fixture plugin. -mod common; +use crate::common; use ide_core::ipc_path::to_ipc; use ide_host::plugins::commands::{plugin_project_view_modify, plugin_run_git_command}; diff --git a/crates/ide-host/tests/plugin_refactoring.rs b/crates/ide-host/tests/integration/plugin_refactoring.rs similarity index 99% rename from crates/ide-host/tests/plugin_refactoring.rs rename to crates/ide-host/tests/integration/plugin_refactoring.rs index b3073c7b4d..62f1088f6d 100644 --- a/crates/ide-host/tests/plugin_refactoring.rs +++ b/crates/ide-host/tests/integration/plugin_refactoring.rs @@ -1,5 +1,5 @@ //! Indexed names use the same preview/apply/undo commands as language-server refactorings. -mod common; +use crate::common; use ide_core::{IdeEvent, Pos, RequestId, error::ErrorKind}; use ide_host::{ diff --git a/crates/ide-host/tests/plugin_rename.rs b/crates/ide-host/tests/integration/plugin_rename.rs similarity index 99% rename from crates/ide-host/tests/plugin_rename.rs rename to crates/ide-host/tests/integration/plugin_rename.rs index 05d79c412a..3aed55880d 100644 --- a/crates/ide-host/tests/plugin_rename.rs +++ b/crates/ide-host/tests/integration/plugin_rename.rs @@ -1,6 +1,6 @@ //! API 1.21 `rename-provider`: prepare-rename, cross-file rename via Invocation, //! capability denial/grant handling, and writable-root path confinement. -mod common; +use crate::common; use ide_core::{FileEdit, Pos, RequestId, error::ErrorKind}; use ide_host::plugins::{Consent, HostWorkspace, PluginHost, set_editor_providers}; diff --git a/crates/ide-host/tests/plugin_run_anything.rs b/crates/ide-host/tests/integration/plugin_run_anything.rs similarity index 100% rename from crates/ide-host/tests/plugin_run_anything.rs rename to crates/ide-host/tests/integration/plugin_run_anything.rs diff --git a/crates/ide-host/tests/plugin_run_output.rs b/crates/ide-host/tests/integration/plugin_run_output.rs similarity index 99% rename from crates/ide-host/tests/plugin_run_output.rs rename to crates/ide-host/tests/integration/plugin_run_output.rs index b4ec5e4305..73a7a9ac7e 100644 --- a/crates/ide-host/tests/plugin_run_output.rs +++ b/crates/ide-host/tests/integration/plugin_run_output.rs @@ -1,6 +1,6 @@ //! API 1.21 `run.output` & `ui.set-console-links`: capability gating, declared-command //! validation, console link snapshots/events, and live RunOutput event delivery. -mod common; +use crate::common; use ide_core::error::ErrorKind; use ide_host::plugins::{Consent, HostWorkspace, PluginEvent, PluginHost}; diff --git a/crates/ide-host/tests/plugin_semantic_tokens.rs b/crates/ide-host/tests/integration/plugin_semantic_tokens.rs similarity index 100% rename from crates/ide-host/tests/plugin_semantic_tokens.rs rename to crates/ide-host/tests/integration/plugin_semantic_tokens.rs diff --git a/crates/ide-host/tests/plugin_server_commands.rs b/crates/ide-host/tests/integration/plugin_server_commands.rs similarity index 99% rename from crates/ide-host/tests/plugin_server_commands.rs rename to crates/ide-host/tests/integration/plugin_server_commands.rs index 35c754a3a8..35c8a27547 100644 --- a/crates/ide-host/tests/plugin_server_commands.rs +++ b/crates/ide-host/tests/integration/plugin_server_commands.rs @@ -1,7 +1,7 @@ //! `[[contributes.serverCommands]]` (plugin API 1.9): a command a language server hands to the //! client runs the plugin command that claims it. The fixture's command sends its argument //! back to the server (`mock/ran`), through the real component runtime and `language-servers`. -mod common; +use crate::common; use ide_host::plugins::{Consent, HostWorkspace, PluginHost, set_editor_providers}; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/plugin_symbols.rs b/crates/ide-host/tests/integration/plugin_symbols.rs similarity index 100% rename from crates/ide-host/tests/plugin_symbols.rs rename to crates/ide-host/tests/integration/plugin_symbols.rs diff --git a/crates/ide-host/tests/plugin_syntax_decorations.rs b/crates/ide-host/tests/integration/plugin_syntax_decorations.rs similarity index 99% rename from crates/ide-host/tests/plugin_syntax_decorations.rs rename to crates/ide-host/tests/integration/plugin_syntax_decorations.rs index 7a79417134..81f42a8316 100644 --- a/crates/ide-host/tests/plugin_syntax_decorations.rs +++ b/crates/ide-host/tests/integration/plugin_syntax_decorations.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{CancellationToken, Pos, Range, RequestId}; use ide_host::plugins::{Consent, PluginHost}; diff --git a/crates/ide-host/tests/plugin_view_badge.rs b/crates/ide-host/tests/integration/plugin_view_badge.rs similarity index 100% rename from crates/ide-host/tests/plugin_view_badge.rs rename to crates/ide-host/tests/integration/plugin_view_badge.rs diff --git a/crates/ide-host/tests/plugin_watch_paths.rs b/crates/ide-host/tests/integration/plugin_watch_paths.rs similarity index 100% rename from crates/ide-host/tests/plugin_watch_paths.rs rename to crates/ide-host/tests/integration/plugin_watch_paths.rs diff --git a/crates/ide-host/tests/plugin_workbench.rs b/crates/ide-host/tests/integration/plugin_workbench.rs similarity index 99% rename from crates/ide-host/tests/plugin_workbench.rs rename to crates/ide-host/tests/integration/plugin_workbench.rs index d818eae488..f0b2738d7a 100644 --- a/crates/ide-host/tests/plugin_workbench.rs +++ b/crates/ide-host/tests/integration/plugin_workbench.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{CancellationToken, Diagnostic, Pos, Range, Severity}; use ide_host::plugins::{HostWorkspace, PluginWorkspace}; diff --git a/crates/ide-host/tests/pom_encoding.rs b/crates/ide-host/tests/integration/pom_encoding.rs similarity index 99% rename from crates/ide-host/tests/pom_encoding.rs rename to crates/ide-host/tests/integration/pom_encoding.rs index 227cf62753..dc107fe3c4 100644 --- a/crates/ide-host/tests/pom_encoding.rs +++ b/crates/ide-host/tests/integration/pom_encoding.rs @@ -1,7 +1,7 @@ //! Maven's `project.build.sourceEncoding` is the encoding of the module's sources, //! without becoming a user choice or overriding EditorConfig. -mod common; +use crate::common; use ide_host::{Host, ops}; use ide_workspace::settings::SettingsScope; diff --git a/crates/ide-host/tests/properties.rs b/crates/ide-host/tests/integration/properties.rs similarity index 99% rename from crates/ide-host/tests/properties.rs rename to crates/ide-host/tests/integration/properties.rs index 9cbeabc0a4..5d39a26c9b 100644 --- a/crates/ide-host/tests/properties.rs +++ b/crates/ide-host/tests/integration/properties.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{ChangeSet, RequestId, TextChange}; use ide_host::{ diff --git a/crates/ide-host/tests/pytest_fixtures.rs b/crates/ide-host/tests/integration/pytest_fixtures.rs similarity index 99% rename from crates/ide-host/tests/pytest_fixtures.rs rename to crates/ide-host/tests/integration/pytest_fixtures.rs index b147d01d8f..914eb14c99 100644 --- a/crates/ide-host/tests/pytest_fixtures.rs +++ b/crates/ide-host/tests/integration/pytest_fixtures.rs @@ -2,7 +2,7 @@ //! on a project on disk: which files are searched, overrides left out, `pytest_plugins` //! modules, `python_files`, body reads and name clashes. -mod common; +use crate::common; use ide_core::{FileEdit, Pos}; use ide_host::{Host, ops}; diff --git a/crates/ide-host/tests/python_move.rs b/crates/ide-host/tests/integration/python_move.rs similarity index 99% rename from crates/ide-host/tests/python_move.rs rename to crates/ide-host/tests/integration/python_move.rs index 441d559c8b..d7dcae0d96 100644 --- a/crates/ide-host/tests/python_move.rs +++ b/crates/ide-host/tests/integration/python_move.rs @@ -2,7 +2,7 @@ //! Python before and after, and must print the same. `#[ignore]`d: it needs `pylsp` on `PATH` //! (the helper runs with that environment's Python). -mod common; +use crate::common; use ide_core::{ChangeSet, IdeEvent, RequestId, SharedSink, TextChange}; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/python_rename_comments.rs b/crates/ide-host/tests/integration/python_rename_comments.rs similarity index 99% rename from crates/ide-host/tests/python_rename_comments.rs rename to crates/ide-host/tests/integration/python_rename_comments.rs index f11658658e..790c014a50 100644 --- a/crates/ide-host/tests/python_rename_comments.rs +++ b/crates/ide-host/tests/integration/python_rename_comments.rs @@ -2,7 +2,7 @@ //! merged edit the preview shows, applying it and undoing it in one step. Needs //! `basedpyright-langserver` on PATH: //! `cargo test -p ide-host --test python_rename_comments -- --ignored` -mod common; +use crate::common; use ide_core::{IdeEvent, Pos, RequestId, WorkspaceEdit}; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/python_signature.rs b/crates/ide-host/tests/integration/python_signature.rs similarity index 100% rename from crates/ide-host/tests/python_signature.rs rename to crates/ide-host/tests/integration/python_signature.rs diff --git a/crates/ide-host/tests/python_signature_ops.rs b/crates/ide-host/tests/integration/python_signature_ops.rs similarity index 99% rename from crates/ide-host/tests/python_signature_ops.rs rename to crates/ide-host/tests/integration/python_signature_ops.rs index 0f4d21831d..b133ca84b3 100644 --- a/crates/ide-host/tests/python_signature_ops.rs +++ b/crates/ide-host/tests/integration/python_signature_ops.rs @@ -2,7 +2,7 @@ //! edit it computes from the open (unsaved) buffers, applying it and undoing it. `#[ignore]`d: //! it needs `pylsp` with rope on `PATH` (`pip install python-lsp-server pylsp-rope`). -mod common; +use crate::common; use ide_core::{ChangeSet, IdeEvent, Pos, RequestId, SharedSink, TextChange, error::ErrorKind}; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/remote_daemon.rs b/crates/ide-host/tests/integration/remote_daemon.rs similarity index 99% rename from crates/ide-host/tests/remote_daemon.rs rename to crates/ide-host/tests/integration/remote_daemon.rs index 1d34f82f4e..610dae0edb 100644 --- a/crates/ide-host/tests/remote_daemon.rs +++ b/crates/ide-host/tests/integration/remote_daemon.rs @@ -3,8 +3,6 @@ //! (including `stopCommand` configs such as `docker compose`) and dirty buffers //! running until a client sends `"shutdown"` or the backend has been idle long enough. -#![cfg(unix)] - use ide_host::rpc::{self, ChannelMessage, EventMessage, Invoke, ServerInfo}; use ide_jsonrpc::{Handler, Peer}; use parking_lot::Mutex; diff --git a/crates/ide-host/tests/remote_plugins.rs b/crates/ide-host/tests/integration/remote_plugins.rs similarity index 99% rename from crates/ide-host/tests/remote_plugins.rs rename to crates/ide-host/tests/integration/remote_plugins.rs index 4ca2a9833f..1a3c0858b4 100644 --- a/crates/ide-host/tests/remote_plugins.rs +++ b/crates/ide-host/tests/integration/remote_plugins.rs @@ -3,9 +3,7 @@ //! code plugins over the remote protocol; Checkstyle then checks the file on //! the server's disk when it is saved, and secrets come from the desktop. -#![cfg(unix)] - -mod common; +use crate::common; use ide_core::IdeEvent; use ide_host::plugins::remote_host::{ diff --git a/crates/ide-host/tests/replace_all.rs b/crates/ide-host/tests/integration/replace_all.rs similarity index 99% rename from crates/ide-host/tests/replace_all.rs rename to crates/ide-host/tests/integration/replace_all.rs index 7f2d2f5175..6cd88ac016 100644 --- a/crates/ide-host/tests/replace_all.rs +++ b/crates/ide-host/tests/integration/replace_all.rs @@ -1,7 +1,7 @@ //! Replace All when the search hit its match limit (#4083): every match in the //! scope is replaced, not just the listed ones. -mod common; +use crate::common; use ide_core::{Pos, RequestId}; use ide_host::{Host, ops}; diff --git a/crates/ide-host/tests/roslyn_editorconfig.rs b/crates/ide-host/tests/integration/roslyn_editorconfig.rs similarity index 99% rename from crates/ide-host/tests/roslyn_editorconfig.rs rename to crates/ide-host/tests/integration/roslyn_editorconfig.rs index 1b9ab599b0..0c9cf4473e 100644 --- a/crates/ide-host/tests/roslyn_editorconfig.rs +++ b/crates/ide-host/tests/integration/roslyn_editorconfig.rs @@ -2,7 +2,7 @@ //! language server installed as Settings does. It downloads the server, so it runs only on request: //! `cargo test -p ide-host --test roslyn_editorconfig -- --ignored`; skipped without a .NET SDK. -mod common; +use crate::common; use ide_core::{DocId, IdeEvent, Pos, Range, RequestId, Severity}; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/roslyn_hints.rs b/crates/ide-host/tests/integration/roslyn_hints.rs similarity index 99% rename from crates/ide-host/tests/roslyn_hints.rs rename to crates/ide-host/tests/integration/roslyn_hints.rs index 0945e10f16..bdeb817611 100644 --- a/crates/ide-host/tests/roslyn_hints.rs +++ b/crates/ide-host/tests/integration/roslyn_hints.rs @@ -2,7 +2,7 @@ //! csharp-ls and the Roslyn language server, installed as Settings does (network). Ignored by //! default: `cargo test -p ide-host --test roslyn_hints -- --ignored`; skipped without a .NET SDK. -mod common; +use crate::common; use ide_core::{DocId, Pos, Range}; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/rpc.rs b/crates/ide-host/tests/integration/rpc.rs similarity index 99% rename from crates/ide-host/tests/rpc.rs rename to crates/ide-host/tests/integration/rpc.rs index a66da9348e..5619c90f29 100644 --- a/crates/ide-host/tests/rpc.rs +++ b/crates/ide-host/tests/integration/rpc.rs @@ -1,7 +1,7 @@ //! The remote protocol end to end: a server on one side of an in-memory pipe, //! a JSON-RPC client on the other. -mod common; +use crate::common; use ide_host::rpc::{self, ChannelMessage, Dispatcher, EventMessage, Invoke, ServerInfo}; use ide_host::{Host, HostConfig}; diff --git a/crates/ide-host/tests/run_configs.rs b/crates/ide-host/tests/integration/run_configs.rs similarity index 99% rename from crates/ide-host/tests/run_configs.rs rename to crates/ide-host/tests/integration/run_configs.rs index 4281e2b47d..c7bc0a77a0 100644 --- a/crates/ide-host/tests/run_configs.rs +++ b/crates/ide-host/tests/integration/run_configs.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_host::{Host, ops}; use std::sync::Arc; diff --git a/crates/ide-host/tests/search_encoding.rs b/crates/ide-host/tests/integration/search_encoding.rs similarity index 99% rename from crates/ide-host/tests/search_encoding.rs rename to crates/ide-host/tests/integration/search_encoding.rs index 9831de0242..1e9a49a0ac 100644 --- a/crates/ide-host/tests/search_encoding.rs +++ b/crates/ide-host/tests/integration/search_encoding.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::RequestId; use ide_host::{Host, ops}; diff --git a/crates/ide-host/tests/settings_sync.rs b/crates/ide-host/tests/integration/settings_sync.rs similarity index 99% rename from crates/ide-host/tests/settings_sync.rs rename to crates/ide-host/tests/integration/settings_sync.rs index b89a738303..d840d24034 100644 --- a/crates/ide-host/tests/settings_sync.rs +++ b/crates/ide-host/tests/integration/settings_sync.rs @@ -1,6 +1,6 @@ //! Settings Sync between two machines through a local bare repository. -mod common; +use crate::common; use ide_host::Host; use ide_host::ops::settings_sync::{SettingsSyncMode, SettingsSyncResult, has_local_changes, sync_now}; diff --git a/crates/ide-host/tests/spell_dictionary.rs b/crates/ide-host/tests/integration/spell_dictionary.rs similarity index 100% rename from crates/ide-host/tests/spell_dictionary.rs rename to crates/ide-host/tests/integration/spell_dictionary.rs diff --git a/crates/ide-host/tests/ssh_terminal.rs b/crates/ide-host/tests/integration/ssh_terminal.rs similarity index 99% rename from crates/ide-host/tests/ssh_terminal.rs rename to crates/ide-host/tests/integration/ssh_terminal.rs index a9e08a8a47..11b3416379 100644 --- a/crates/ide-host/tests/ssh_terminal.rs +++ b/crates/ide-host/tests/integration/ssh_terminal.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::remote_settings::{SshAuth, SshConfiguration}; use ide_core::{IdeEvent, SharedSink}; diff --git a/crates/ide-host/tests/svn.rs b/crates/ide-host/tests/integration/svn.rs similarity index 99% rename from crates/ide-host/tests/svn.rs rename to crates/ide-host/tests/integration/svn.rs index 37310b6fbe..3abe0aff53 100644 --- a/crates/ide-host/tests/svn.rs +++ b/crates/ide-host/tests/integration/svn.rs @@ -1,7 +1,7 @@ //! Subversion working copies through the shared `vcs_*` commands and the //! `svn_*` ones, against throwaway `svnadmin` repositories (`file://` URLs). //! Skipped when `svn` or `svnadmin` is not installed. -mod common; +use crate::common; use ide_core::CancellationToken; use ide_host::Host; diff --git a/crates/ide-host/tests/terminal_images.rs b/crates/ide-host/tests/integration/terminal_images.rs similarity index 97% rename from crates/ide-host/tests/terminal_images.rs rename to crates/ide-host/tests/integration/terminal_images.rs index ceea03ea4b..17e2d670bd 100644 --- a/crates/ide-host/tests/terminal_images.rs +++ b/crates/ide-host/tests/integration/terminal_images.rs @@ -1,6 +1,4 @@ -#![cfg(any(unix, windows))] - -mod common; +use crate::common; use ide_core::{NullSink, TerminalId}; use ide_host::{Host, ops}; diff --git a/crates/ide-host/tests/trust.rs b/crates/ide-host/tests/integration/trust.rs similarity index 99% rename from crates/ide-host/tests/trust.rs rename to crates/ide-host/tests/integration/trust.rs index d4aa89511a..48d7cb8e30 100644 --- a/crates/ide-host/tests/trust.rs +++ b/crates/ide-host/tests/integration/trust.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; #[cfg(unix)] use ide_host::ops; diff --git a/crates/ide-host/tests/trust_git_binary.rs b/crates/ide-host/tests/integration/trust_git_binary.rs similarity index 97% rename from crates/ide-host/tests/trust_git_binary.rs rename to crates/ide-host/tests/integration/trust_git_binary.rs index d26f16b427..d15bcee023 100644 --- a/crates/ide-host/tests/trust_git_binary.rs +++ b/crates/ide-host/tests/integration/trust_git_binary.rs @@ -1,7 +1,5 @@ -//! Which git executable each window's repositories run. Its own test binary: the default -//! executable (global settings) is process-wide. -#![cfg(unix)] -mod common; +//! Which git executable each window's repositories run (project-scoped `.openidea/settings.toml`). +use crate::common; use ide_host::{Host, ops}; use std::os::unix::fs::PermissionsExt; diff --git a/crates/ide-host/tests/trust_vcs_sweep.rs b/crates/ide-host/tests/integration/trust_vcs_sweep.rs similarity index 99% rename from crates/ide-host/tests/trust_vcs_sweep.rs rename to crates/ide-host/tests/integration/trust_vcs_sweep.rs index 71df600ceb..525853fd69 100644 --- a/crates/ide-host/tests/trust_vcs_sweep.rs +++ b/crates/ide-host/tests/integration/trust_vcs_sweep.rs @@ -1,7 +1,7 @@ //! Security audit lead 2: every `vcs_*` command Restricted Mode allows, run against a //! repository whose config names a program for a signed commit, an index read, an external //! diff, a clean filter and a missing object. None may run. -mod common; +use crate::common; use ide_core::RequestId; use ide_host::{Host, catalogue::TrustClass, ops, ops::vcs}; diff --git a/crates/ide-host/tests/unity.rs b/crates/ide-host/tests/integration/unity.rs similarity index 99% rename from crates/ide-host/tests/unity.rs rename to crates/ide-host/tests/integration/unity.rs index 41f90e2701..a8a03fc078 100644 --- a/crates/ide-host/tests/unity.rs +++ b/crates/ide-host/tests/integration/unity.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::RequestId; use ide_host::{Host, ops}; diff --git a/crates/ide-host/tests/vcs_backends.rs b/crates/ide-host/tests/integration/vcs_backends.rs similarity index 99% rename from crates/ide-host/tests/vcs_backends.rs rename to crates/ide-host/tests/integration/vcs_backends.rs index 2b5fbe1309..f3d9c1de1c 100644 --- a/crates/ide-host/tests/vcs_backends.rs +++ b/crates/ide-host/tests/integration/vcs_backends.rs @@ -1,7 +1,7 @@ //! A version control system besides Git plugs in through `BackendProvider`, the way //! Perforce and Subversion do: an in-memory fake here, so nothing but `git` has to be //! installed. -mod common; +use crate::common; use ide_core::{CancellationToken, IdeError, IdeResult}; use ide_host::{ diff --git a/crates/ide-host/tests/vcs_delete_added.rs b/crates/ide-host/tests/integration/vcs_delete_added.rs similarity index 99% rename from crates/ide-host/tests/vcs_delete_added.rs rename to crates/ide-host/tests/integration/vcs_delete_added.rs index 99b4daa6ef..9558428572 100644 --- a/crates/ide-host/tests/vcs_delete_added.rs +++ b/crates/ide-host/tests/integration/vcs_delete_added.rs @@ -1,7 +1,7 @@ //! #7333: Delete of a file that was only added to Git also drops it from the index, as IDEA //! does, so it does not linger as `AD`; Undo brings the content back without touching the index. -mod common; +use crate::common; use ide_host::{Host, Project}; use std::{ diff --git a/crates/ide-host/tests/vcs_documents.rs b/crates/ide-host/tests/integration/vcs_documents.rs similarity index 99% rename from crates/ide-host/tests/vcs_documents.rs rename to crates/ide-host/tests/integration/vcs_documents.rs index ac83990157..1fda331ecb 100644 --- a/crates/ide-host/tests/vcs_documents.rs +++ b/crates/ide-host/tests/integration/vcs_documents.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{ChangeSet, TextChange}; use ide_host::{Host, Project, ops::vcs}; diff --git a/crates/ide-host/tests/vcs_encoding.rs b/crates/ide-host/tests/integration/vcs_encoding.rs similarity index 99% rename from crates/ide-host/tests/vcs_encoding.rs rename to crates/ide-host/tests/integration/vcs_encoding.rs index bf90bcb5f5..db4067c89d 100644 --- a/crates/ide-host/tests/vcs_encoding.rs +++ b/crates/ide-host/tests/integration/vcs_encoding.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{ChangeSet, TextChange}; use ide_host::{Host, Project, ops::vcs}; diff --git a/crates/ide-host/tests/vcs_flow.rs b/crates/ide-host/tests/integration/vcs_flow.rs similarity index 99% rename from crates/ide-host/tests/vcs_flow.rs rename to crates/ide-host/tests/integration/vcs_flow.rs index c142b0ae14..a2072cdb85 100644 --- a/crates/ide-host/tests/vcs_flow.rs +++ b/crates/ide-host/tests/integration/vcs_flow.rs @@ -2,7 +2,7 @@ //! marked in the gutter, Local Changes and its diff, a commit in the log, a branch, a stash, and //! a merge that conflicts, resolved and committed. Open documents follow every step. -mod common; +use crate::common; use ide_core::DocId; use ide_host::{Host, ops}; diff --git a/crates/ide-host/tests/vcs_roots.rs b/crates/ide-host/tests/integration/vcs_roots.rs similarity index 99% rename from crates/ide-host/tests/vcs_roots.rs rename to crates/ide-host/tests/integration/vcs_roots.rs index a174d4f5a6..4356af976c 100644 --- a/crates/ide-host/tests/vcs_roots.rs +++ b/crates/ide-host/tests/integration/vcs_roots.rs @@ -1,5 +1,5 @@ //! Repository-scoped patch operations must never fall back to the primary root. -mod common; +use crate::common; use ide_host::{Host, ops::vcs}; use std::{path::Path, process::Command, time::Duration}; diff --git a/crates/ide-host/tests/vcs_shelf_roots.rs b/crates/ide-host/tests/integration/vcs_shelf_roots.rs similarity index 99% rename from crates/ide-host/tests/vcs_shelf_roots.rs rename to crates/ide-host/tests/integration/vcs_shelf_roots.rs index 1ddd12afcf..5d1e408312 100644 --- a/crates/ide-host/tests/vcs_shelf_roots.rs +++ b/crates/ide-host/tests/integration/vcs_shelf_roots.rs @@ -1,5 +1,5 @@ //! Shelves retain their repository even when the project root is above or below it. -mod common; +use crate::common; use ide_host::{Host, ops::vcs}; use std::{path::Path, process::Command, time::Duration}; diff --git a/crates/ide-host/tests/vcs_watcher_moved_repository.rs b/crates/ide-host/tests/integration/vcs_watcher_moved_repository.rs similarity index 99% rename from crates/ide-host/tests/vcs_watcher_moved_repository.rs rename to crates/ide-host/tests/integration/vcs_watcher_moved_repository.rs index 9d651434b5..02d8733fd2 100644 --- a/crates/ide-host/tests/vcs_watcher_moved_repository.rs +++ b/crates/ide-host/tests/integration/vcs_watcher_moved_repository.rs @@ -2,7 +2,7 @@ //! the folder brings no `.git` event of its own, so the watcher's "created path" is what the //! rescan has to answer to (the open scan already ran). -mod common; +use crate::common; use ide_host::Host; use std::{path::Path, time::Duration}; diff --git a/crates/ide-host/tests/vcs_worktrees.rs b/crates/ide-host/tests/integration/vcs_worktrees.rs similarity index 99% rename from crates/ide-host/tests/vcs_worktrees.rs rename to crates/ide-host/tests/integration/vcs_worktrees.rs index ce080f70ae..faf5107167 100644 --- a/crates/ide-host/tests/vcs_worktrees.rs +++ b/crates/ide-host/tests/integration/vcs_worktrees.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::RequestId; use ide_host::{Host, Project, ops::vcs}; diff --git a/crates/ide-host/tests/workspace_edits.rs b/crates/ide-host/tests/integration/workspace_edits.rs similarity index 99% rename from crates/ide-host/tests/workspace_edits.rs rename to crates/ide-host/tests/integration/workspace_edits.rs index 8079afc3bd..810a0194b8 100644 --- a/crates/ide-host/tests/workspace_edits.rs +++ b/crates/ide-host/tests/integration/workspace_edits.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{IdeEvent, SharedSink, WorkspaceEdit, error::ErrorKind}; use ide_host::{Host, HostConfig, ops}; diff --git a/crates/ide-host/tests/workspaces.rs b/crates/ide-host/tests/integration/workspaces.rs similarity index 99% rename from crates/ide-host/tests/workspaces.rs rename to crates/ide-host/tests/integration/workspaces.rs index cf90e653c8..c6994f2e06 100644 --- a/crates/ide-host/tests/workspaces.rs +++ b/crates/ide-host/tests/integration/workspaces.rs @@ -1,4 +1,4 @@ -mod common; +use crate::common; use ide_core::{ChangeSet, RequestId, TextChange}; use ide_host::{Host, ops}; diff --git a/crates/ide-lsp/tests/integration/main.rs b/crates/ide-lsp/tests/integration/main.rs new file mode 100644 index 0000000000..39be05757d --- /dev/null +++ b/crates/ide-lsp/tests/integration/main.rs @@ -0,0 +1,5 @@ +mod mock_server; +mod real_servers; +#[cfg(unix)] +mod stdio_crash; +mod tcp_server; diff --git a/crates/ide-lsp/tests/mock_server.rs b/crates/ide-lsp/tests/integration/mock_server.rs similarity index 100% rename from crates/ide-lsp/tests/mock_server.rs rename to crates/ide-lsp/tests/integration/mock_server.rs diff --git a/crates/ide-lsp/tests/real_servers.rs b/crates/ide-lsp/tests/integration/real_servers.rs similarity index 99% rename from crates/ide-lsp/tests/real_servers.rs rename to crates/ide-lsp/tests/integration/real_servers.rs index 9da3e073cf..5d6ac3d199 100644 --- a/crates/ide-lsp/tests/real_servers.rs +++ b/crates/ide-lsp/tests/integration/real_servers.rs @@ -291,7 +291,7 @@ async fn java_searches_skip_indexed_sources_but_keep_exclusions_outside_scope() async fn lombok_generated_members_appear_in_document_symbols() { let dir = tempfile::tempdir().unwrap(); let root = dunce::canonicalize(dir.path()).unwrap(); - let source = include_str!("fixtures/LombokSymbols.java"); + let source = include_str!("../fixtures/LombokSymbols.java"); let path = root.join("src/demo/LombokSymbols.java"); std::fs::create_dir_all(path.parent().unwrap()).unwrap(); std::fs::write(&path, source).unwrap(); @@ -357,8 +357,8 @@ async fn lombok_generated_members_appear_in_document_symbols() { async fn intellij_java_formatter_preserves_manual_breaks_and_wraps_long_lines() { let dir = tempfile::tempdir().unwrap(); let root = dir.path().canonicalize().unwrap(); - let source = include_str!("fixtures/FormatterSample.input.java"); - let expected = include_str!("fixtures/FormatterSample.intellij.java"); + let source = include_str!("../fixtures/FormatterSample.input.java"); + let expected = include_str!("../fixtures/FormatterSample.intellij.java"); let path = root.join("src/demo/FormatterSample.java"); std::fs::create_dir_all(path.parent().unwrap()).unwrap(); std::fs::write(&path, source).unwrap(); @@ -911,7 +911,7 @@ async fn bundler_path_aliases_resolve_below_tsconfig_paths() { } // What the settings hook writes for `alias: { '@': path.resolve(__dirname, 'src') }`. let plugin = root.join("plugin/node_modules/openidea-path-aliases"); - std::fs::write(plugin.join("index.js"), include_str!("../../ide-sdk/src/path-aliases.js")).unwrap(); + std::fs::write(plugin.join("index.js"), include_str!("../../../ide-sdk/src/path-aliases.js")).unwrap(); let src = slash(&root.join("src")); let paths = serde_json::json!({ slash(&root): { "@": [src], "@/*": [format!("{src}/*")] } }); std::fs::write(plugin.join("paths.json"), paths.to_string()).unwrap(); diff --git a/crates/ide-lsp/tests/stdio_crash.rs b/crates/ide-lsp/tests/integration/stdio_crash.rs similarity index 99% rename from crates/ide-lsp/tests/stdio_crash.rs rename to crates/ide-lsp/tests/integration/stdio_crash.rs index 4bc4ec8c05..3e260cbf13 100644 --- a/crates/ide-lsp/tests/stdio_crash.rs +++ b/crates/ide-lsp/tests/integration/stdio_crash.rs @@ -1,6 +1,5 @@ //! A stdio server that dies before the handshake: what it printed (on stderr, and //! on stdout outside the protocol, in any encoding) must reach the crash message. -#![cfg(unix)] use ide_core::event::ServerStatus; use ide_core::{CancellationToken, DocId, IdeEvent, LanguageId}; diff --git a/crates/ide-lsp/tests/tcp_server.rs b/crates/ide-lsp/tests/integration/tcp_server.rs similarity index 100% rename from crates/ide-lsp/tests/tcp_server.rs rename to crates/ide-lsp/tests/integration/tcp_server.rs diff --git a/crates/ide-run/tests/config.rs b/crates/ide-run/tests/integration/config.rs similarity index 100% rename from crates/ide-run/tests/config.rs rename to crates/ide-run/tests/integration/config.rs diff --git a/crates/ide-run/tests/detect.rs b/crates/ide-run/tests/integration/detect.rs similarity index 100% rename from crates/ide-run/tests/detect.rs rename to crates/ide-run/tests/integration/detect.rs diff --git a/crates/ide-run/tests/dotnet.rs b/crates/ide-run/tests/integration/dotnet.rs similarity index 100% rename from crates/ide-run/tests/dotnet.rs rename to crates/ide-run/tests/integration/dotnet.rs diff --git a/crates/ide-run/tests/dotnet_cli.rs b/crates/ide-run/tests/integration/dotnet_cli.rs similarity index 100% rename from crates/ide-run/tests/dotnet_cli.rs rename to crates/ide-run/tests/integration/dotnet_cli.rs diff --git a/crates/ide-run/tests/import_jetbrains.rs b/crates/ide-run/tests/integration/import_jetbrains.rs similarity index 100% rename from crates/ide-run/tests/import_jetbrains.rs rename to crates/ide-run/tests/integration/import_jetbrains.rs diff --git a/crates/ide-run/tests/import_vscode.rs b/crates/ide-run/tests/integration/import_vscode.rs similarity index 100% rename from crates/ide-run/tests/import_vscode.rs rename to crates/ide-run/tests/integration/import_vscode.rs diff --git a/crates/ide-run/tests/integration/main.rs b/crates/ide-run/tests/integration/main.rs new file mode 100644 index 0000000000..7187da2dc1 --- /dev/null +++ b/crates/ide-run/tests/integration/main.rs @@ -0,0 +1,15 @@ +mod config; +mod detect; +mod dotnet; +mod dotnet_cli; +mod import_jetbrains; +mod import_vscode; +#[cfg(unix)] +mod process; +#[cfg(unix)] +mod stop_group; +#[cfg(windows)] +mod stop_tree; +mod tomcat_artifact; +#[cfg(windows)] +mod windows_output; diff --git a/crates/ide-run/tests/process.rs b/crates/ide-run/tests/integration/process.rs similarity index 99% rename from crates/ide-run/tests/process.rs rename to crates/ide-run/tests/integration/process.rs index ee57a65b3b..d757cccc6b 100644 --- a/crates/ide-run/tests/process.rs +++ b/crates/ide-run/tests/integration/process.rs @@ -1,5 +1,3 @@ -#![cfg(unix)] - use ide_core::{IdeEvent, RunId, SharedSink}; use ide_run::junit::ReportSnapshot; use ide_run::{OutputChunk, ProcessManager, RunConfig, StartOptions}; diff --git a/crates/ide-run/tests/stop_group.rs b/crates/ide-run/tests/integration/stop_group.rs similarity index 99% rename from crates/ide-run/tests/stop_group.rs rename to crates/ide-run/tests/integration/stop_group.rs index ebf7c842f3..fb58c6bb23 100644 --- a/crates/ide-run/tests/stop_group.rs +++ b/crates/ide-run/tests/integration/stop_group.rs @@ -1,6 +1,5 @@ //! A stopped run reports its exit only once the whole process group is gone, so the next //! start cannot meet a port the previous process still holds. -#![cfg(unix)] use ide_core::{IdeEvent, RunId, SharedSink}; use ide_run::{ProcessManager, RunConfig, StartOptions}; diff --git a/crates/ide-run/tests/stop_tree.rs b/crates/ide-run/tests/integration/stop_tree.rs similarity index 99% rename from crates/ide-run/tests/stop_tree.rs rename to crates/ide-run/tests/integration/stop_tree.rs index 6cac1a6f61..48265546e6 100644 --- a/crates/ide-run/tests/stop_tree.rs +++ b/crates/ide-run/tests/integration/stop_tree.rs @@ -2,7 +2,6 @@ //! launch reaches what a launcher started even when the launcher exited first (where a //! `taskkill /T /F` from the tracked pid no longer finds the orphan), and the run only //! reports its exit once the port the tree held is free again. -#![cfg(windows)] use ide_core::{IdeEvent, RunId, SharedSink}; use ide_run::{OutputChunk, ProcessManager, RunConfig, StartOptions}; diff --git a/crates/ide-run/tests/tomcat_artifact.rs b/crates/ide-run/tests/integration/tomcat_artifact.rs similarity index 100% rename from crates/ide-run/tests/tomcat_artifact.rs rename to crates/ide-run/tests/integration/tomcat_artifact.rs diff --git a/crates/ide-run/tests/windows_output.rs b/crates/ide-run/tests/integration/windows_output.rs similarity index 96% rename from crates/ide-run/tests/windows_output.rs rename to crates/ide-run/tests/integration/windows_output.rs index 747e13e7a7..112d99ba35 100644 --- a/crates/ide-run/tests/windows_output.rs +++ b/crates/ide-run/tests/integration/windows_output.rs @@ -1,69 +1,67 @@ -#![cfg(windows)] - -use ide_core::{IdeEvent, SharedSink}; -use ide_run::{OutputChunk, ProcessManager, RunConfig, StartOptions}; -use parking_lot::Mutex; -use std::collections::BTreeMap; -use std::sync::Arc; -use std::sync::mpsc; -use std::time::Duration; - -/// Stdout and stderr of a shell command line run on pipes in a UTF-8 console. -fn run(command: &str) -> String { - let (tx, events) = mpsc::channel(); - let tx = Mutex::new(tx); - let sink: SharedSink = Arc::new(move |e: IdeEvent| { - let _ = tx.lock().send(e); - }); - let root = tempfile::tempdir().unwrap(); - let config = RunConfig { - id: "t:out".into(), - name: "t:out".into(), - kind: "shell".into(), - command: command.into(), - args: Vec::new(), - cwd: None, - env: BTreeMap::new(), - detected: false, - is_test: false, - debug_adapter: None, - allow_parallel: false, - extras: Default::default(), - }; - let chunks: Arc>> = Arc::default(); - let out = chunks.clone(); - let pm = ProcessManager::new(); - let info = pm - .start(root.path(), &config, &StartOptions::default(), sink, Box::new(move |c| out.lock().push(c))) - .expect("start"); - loop { - match events.recv_timeout(Duration::from_secs(20)).expect("RunExited event") { - IdeEvent::RunExited { run, .. } if run == info.id => break, - _ => {} - } - } - chunks - .lock() - .iter() - .filter_map(|c| match c { - OutputChunk::Stdout { text } | OutputChunk::Stderr { text } => Some(text.as_str()), - _ => None, - }) - .collect() -} - -/// `cmd`'s own messages reach the pipe in the console code page (GBK, Shift_JIS, EUC-KR, -/// 437…, by the system's language), and still read right in a UTF-8 console. -#[test] -fn native_messages_in_the_console_code_page_are_decoded() { - let text = run(r"dir C:\openidea-no-such-dir"); - assert!(text.trim().lines().count() >= 2, "{text:?}"); - assert!(!text.contains('\u{FFFD}'), "{text:?}"); -} - -/// `cmd /u` writes UTF-16LE, as `wsl.exe` does; it reads right whatever the system's language. -#[test] -fn utf16_output_is_decoded() { - let text = run("cmd /u /c echo 中文 한국어 OK"); - assert_eq!(text, "中文 한국어 OK\r\n"); -} +use ide_core::{IdeEvent, SharedSink}; +use ide_run::{OutputChunk, ProcessManager, RunConfig, StartOptions}; +use parking_lot::Mutex; +use std::collections::BTreeMap; +use std::sync::Arc; +use std::sync::mpsc; +use std::time::Duration; + +/// Stdout and stderr of a shell command line run on pipes in a UTF-8 console. +fn run(command: &str) -> String { + let (tx, events) = mpsc::channel(); + let tx = Mutex::new(tx); + let sink: SharedSink = Arc::new(move |e: IdeEvent| { + let _ = tx.lock().send(e); + }); + let root = tempfile::tempdir().unwrap(); + let config = RunConfig { + id: "t:out".into(), + name: "t:out".into(), + kind: "shell".into(), + command: command.into(), + args: Vec::new(), + cwd: None, + env: BTreeMap::new(), + detected: false, + is_test: false, + debug_adapter: None, + allow_parallel: false, + extras: Default::default(), + }; + let chunks: Arc>> = Arc::default(); + let out = chunks.clone(); + let pm = ProcessManager::new(); + let info = pm + .start(root.path(), &config, &StartOptions::default(), sink, Box::new(move |c| out.lock().push(c))) + .expect("start"); + loop { + match events.recv_timeout(Duration::from_secs(20)).expect("RunExited event") { + IdeEvent::RunExited { run, .. } if run == info.id => break, + _ => {} + } + } + chunks + .lock() + .iter() + .filter_map(|c| match c { + OutputChunk::Stdout { text } | OutputChunk::Stderr { text } => Some(text.as_str()), + _ => None, + }) + .collect() +} + +/// `cmd`'s own messages reach the pipe in the console code page (GBK, Shift_JIS, EUC-KR, +/// 437…, by the system's language), and still read right in a UTF-8 console. +#[test] +fn native_messages_in_the_console_code_page_are_decoded() { + let text = run(r"dir C:\openidea-no-such-dir"); + assert!(text.trim().lines().count() >= 2, "{text:?}"); + assert!(!text.contains('\u{FFFD}'), "{text:?}"); +} + +/// `cmd /u` writes UTF-16LE, as `wsl.exe` does; it reads right whatever the system's language. +#[test] +fn utf16_output_is_decoded() { + let text = run("cmd /u /c echo 中文 한국어 OK"); + assert_eq!(text, "中文 한국어 OK\r\n"); +} diff --git a/crates/ide-svn/tests/feedback.rs b/crates/ide-svn/tests/integration/feedback.rs similarity index 99% rename from crates/ide-svn/tests/feedback.rs rename to crates/ide-svn/tests/integration/feedback.rs index 8e7e67b4eb..94039e406a 100644 --- a/crates/ide-svn/tests/feedback.rs +++ b/crates/ide-svn/tests/integration/feedback.rs @@ -1,6 +1,4 @@ -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_vcs::{Backend, LogQuery}; diff --git a/crates/ide-svn/tests/ij_auth.rs b/crates/ide-svn/tests/integration/ij_auth.rs similarity index 99% rename from crates/ide-svn/tests/ij_auth.rs rename to crates/ide-svn/tests/integration/ij_auth.rs index b64e93bdea..695bf8ae7d 100644 --- a/crates/ide-svn/tests/ij_auth.rs +++ b/crates/ide-svn/tests/integration/ij_auth.rs @@ -11,9 +11,7 @@ //! `svn+ssh://` through a stand-in `SVN_SSH` running `svnserve -t`; version output //! through stand-in `svn` scripts. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_core::error::ErrorKind; use ide_svn::{Depth, Prompt, PromptHandler, Settings, SvnContext, WorkingCopy}; diff --git a/crates/ide-svn/tests/ij_changelists.rs b/crates/ide-svn/tests/integration/ij_changelists.rs similarity index 99% rename from crates/ide-svn/tests/ij_changelists.rs rename to crates/ide-svn/tests/integration/ij_changelists.rs index 3246701871..600f5ff122 100644 --- a/crates/ide-svn/tests/ij_changelists.rs +++ b/crates/ide-svn/tests/integration/ij_changelists.rs @@ -9,9 +9,7 @@ //! default one, so here the files are moved to a named list, as the Commit window does for a //! list that is not the default one. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::WorkingCopy; use ide_vcs::{Backend, ChangeKind}; diff --git a/crates/ide-svn/tests/ij_committed.rs b/crates/ide-svn/tests/integration/ij_committed.rs similarity index 99% rename from crates/ide-svn/tests/ij_committed.rs rename to crates/ide-svn/tests/integration/ij_committed.rs index 4fbc3206be..42e5465f04 100644 --- a/crates/ide-svn/tests/ij_committed.rs +++ b/crates/ide-svn/tests/integration/ij_committed.rs @@ -3,9 +3,7 @@ //! OpenIDEA shows a revision's files in the Log (`commit_files`) and diffs each one against //! the revision before (`commits_changes`, `file_at`). Skipped without `svn` locally. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::WorkingCopy; use ide_vcs::Backend; diff --git a/crates/ide-svn/tests/ij_externals.rs b/crates/ide-svn/tests/integration/ij_externals.rs similarity index 99% rename from crates/ide-svn/tests/ij_externals.rs rename to crates/ide-svn/tests/integration/ij_externals.rs index f31f5f76b0..8f5eb86b75 100644 --- a/crates/ide-svn/tests/ij_externals.rs +++ b/crates/ide-svn/tests/integration/ij_externals.rs @@ -6,9 +6,7 @@ //! working copy updated, and the external looked for at the folder IntelliJ expects. //! Skipped without `svn` locally. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::WorkingCopy; use ide_vcs::Backend; diff --git a/crates/ide-svn/tests/ij_files.rs b/crates/ide-svn/tests/integration/ij_files.rs similarity index 99% rename from crates/ide-svn/tests/ij_files.rs rename to crates/ide-svn/tests/integration/ij_files.rs index c4f06d493b..648c504200 100644 --- a/crates/ide-svn/tests/ij_files.rs +++ b/crates/ide-svn/tests/integration/ij_files.rs @@ -5,9 +5,7 @@ //! root is checked in crates/ide-host/tests/ij_svn_roots.rs. Skipped without //! `svn` locally; required in CI. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::WorkingCopy; use ide_vcs::{Backend, LogQuery}; diff --git a/crates/ide-svn/tests/ij_history.rs b/crates/ide-svn/tests/integration/ij_history.rs similarity index 99% rename from crates/ide-svn/tests/ij_history.rs rename to crates/ide-svn/tests/integration/ij_history.rs index 3c0a049fd2..b3313d912f 100644 --- a/crates/ide-svn/tests/ij_history.rs +++ b/crates/ide-svn/tests/integration/ij_history.rs @@ -4,9 +4,7 @@ //! repositories through the IDE's operations. The editor side of the annotation //! scenarios is `src/features/vcs/__tests__/ijAnnotations.test.ts`. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::WorkingCopy; use ide_vcs::{Backend, ChangeKind, LogQuery}; diff --git a/crates/ide-svn/tests/ij_merge.rs b/crates/ide-svn/tests/integration/ij_merge.rs similarity index 99% rename from crates/ide-svn/tests/ij_merge.rs rename to crates/ide-svn/tests/integration/ij_merge.rs index 0116758000..adc561f5c7 100644 --- a/crates/ide-svn/tests/ij_merge.rs +++ b/crates/ide-svn/tests/integration/ij_merge.rs @@ -5,9 +5,7 @@ //! Changes view shows the merged file and the working copy's root (its new mergeinfo). //! Skipped without `svn` locally. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::WorkingCopy; use ide_vcs::Backend; diff --git a/crates/ide-svn/tests/ij_rename_rollback.rs b/crates/ide-svn/tests/integration/ij_rename_rollback.rs similarity index 99% rename from crates/ide-svn/tests/ij_rename_rollback.rs rename to crates/ide-svn/tests/integration/ij_rename_rollback.rs index dc39102eef..0ada978aa3 100644 --- a/crates/ide-svn/tests/ij_rename_rollback.rs +++ b/crates/ide-svn/tests/integration/ij_rename_rollback.rs @@ -5,9 +5,7 @@ //! `files_deleted`); an undo is the IDE moving the file back the same way. Rollback in the //! Changes view discards the rows chosen, a folder taking the rows below it. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::WorkingCopy; use ide_vcs::{Backend, ChangeKind, LogQuery}; diff --git a/crates/ide-svn/tests/incoming_and_branches.rs b/crates/ide-svn/tests/integration/incoming_and_branches.rs similarity index 99% rename from crates/ide-svn/tests/incoming_and_branches.rs rename to crates/ide-svn/tests/integration/incoming_and_branches.rs index 591653d22a..ea042e78ae 100644 --- a/crates/ide-svn/tests/incoming_and_branches.rs +++ b/crates/ide-svn/tests/integration/incoming_and_branches.rs @@ -1,7 +1,6 @@ //! Incoming remote status, working copy metadata, branch layout, branch comparison, and custom switch tests. -mod common; -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::Depth; use ide_vcs::Backend; diff --git a/crates/ide-svn/tests/integration/main.rs b/crates/ide-svn/tests/integration/main.rs new file mode 100644 index 0000000000..183fe0af62 --- /dev/null +++ b/crates/ide-svn/tests/integration/main.rs @@ -0,0 +1,20 @@ +#[path = "../common/mod.rs"] +mod common; + +mod feedback; +mod ij_auth; +mod ij_changelists; +mod ij_committed; +mod ij_externals; +mod ij_files; +mod ij_history; +mod ij_merge; +mod ij_rename_rollback; +mod incoming_and_branches; +mod matrix; +mod merge_ui; +mod remote_browser; +mod settings; +mod shelf; +mod wc_ops; +mod working_copy; diff --git a/crates/ide-svn/tests/matrix.rs b/crates/ide-svn/tests/integration/matrix.rs similarity index 99% rename from crates/ide-svn/tests/matrix.rs rename to crates/ide-svn/tests/integration/matrix.rs index bc109b1dbb..a809669ce5 100644 --- a/crates/ide-svn/tests/matrix.rs +++ b/crates/ide-svn/tests/integration/matrix.rs @@ -4,9 +4,7 @@ //! (`subversion/tests/cmdline/*.py`); scenarios also come from IntelliJ's //! svn4idea tests. Skipped without `svn` locally; required in CI. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_vcs::{Backend, ChangeKind, CommitOptions, LogQuery, TextEncoding}; use std::path::{Path, PathBuf}; diff --git a/crates/ide-svn/tests/merge_ui.rs b/crates/ide-svn/tests/integration/merge_ui.rs similarity index 99% rename from crates/ide-svn/tests/merge_ui.rs rename to crates/ide-svn/tests/integration/merge_ui.rs index d06cf2fa26..42978b587d 100644 --- a/crates/ide-svn/tests/merge_ui.rs +++ b/crates/ide-svn/tests/integration/merge_ui.rs @@ -1,5 +1,5 @@ //! Integration tests for Subversion merge options, eligible revisions, and reverse merge. -mod common; +use crate::common; use ide_core::CancellationToken; use ide_svn::{Depth, MergeOptions, WorkingCopy}; diff --git a/crates/ide-svn/tests/remote_browser.rs b/crates/ide-svn/tests/integration/remote_browser.rs similarity index 99% rename from crates/ide-svn/tests/remote_browser.rs rename to crates/ide-svn/tests/integration/remote_browser.rs index 93f862212e..a2c57fef92 100644 --- a/crates/ide-svn/tests/remote_browser.rs +++ b/crates/ide-svn/tests/integration/remote_browser.rs @@ -1,7 +1,6 @@ //! Repository browser, export, and checkout option operations in `ide_svn`. -mod common; -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_svn::{ Depth, WorkingCopy, cat_url, export_url, list_url, remote_copy, remote_delete, remote_log, remote_mkdir, diff --git a/crates/ide-svn/tests/settings.rs b/crates/ide-svn/tests/integration/settings.rs similarity index 99% rename from crates/ide-svn/tests/settings.rs rename to crates/ide-svn/tests/integration/settings.rs index a75d67dd5f..c01a934840 100644 --- a/crates/ide-svn/tests/settings.rs +++ b/crates/ide-svn/tests/integration/settings.rs @@ -2,9 +2,9 @@ //! throwaway `svnserve` with a password database, and their scope: one //! project's context. Skipped when `svn`, `svnadmin` or `svnserve` is not installed. -mod common; +use crate::common; -use common::{Svnserve, svnserve}; +use crate::common::{Svnserve, svnserve}; use ide_core::CancellationToken; use ide_core::error::ErrorKind; use ide_svn::{Depth, Prompt, PromptHandler, Settings, SvnContext, WorkingCopy}; diff --git a/crates/ide-svn/tests/shelf.rs b/crates/ide-svn/tests/integration/shelf.rs similarity index 98% rename from crates/ide-svn/tests/shelf.rs rename to crates/ide-svn/tests/integration/shelf.rs index 31c806205e..43a55b4bd1 100644 --- a/crates/ide-svn/tests/shelf.rs +++ b/crates/ide-svn/tests/integration/shelf.rs @@ -1,7 +1,6 @@ //! Shelve Changes in a working copy: the patch the shelf keeps and the rollback after it. -mod common; -use common::{repo, write}; +use crate::common::{repo, write}; /// A file changed between saving its patch on the shelf and rolling it back is left alone. #[test] diff --git a/crates/ide-svn/tests/wc_ops.rs b/crates/ide-svn/tests/integration/wc_ops.rs similarity index 99% rename from crates/ide-svn/tests/wc_ops.rs rename to crates/ide-svn/tests/integration/wc_ops.rs index b54639899d..80c1714f72 100644 --- a/crates/ide-svn/tests/wc_ops.rs +++ b/crates/ide-svn/tests/integration/wc_ops.rs @@ -1,5 +1,5 @@ //! Integration tests for Subversion working copy operations (ignore, property diffs, cleanup, update options, URL lookup). -mod common; +use crate::common; use ide_core::CancellationToken; use ide_svn::{CleanupOptions, Depth, PropertyDiff, UpdateOptions, WorkingCopy}; diff --git a/crates/ide-svn/tests/working_copy.rs b/crates/ide-svn/tests/integration/working_copy.rs similarity index 99% rename from crates/ide-svn/tests/working_copy.rs rename to crates/ide-svn/tests/integration/working_copy.rs index 53ab80baa2..1a83726418 100644 --- a/crates/ide-svn/tests/working_copy.rs +++ b/crates/ide-svn/tests/integration/working_copy.rs @@ -2,9 +2,7 @@ //! `file://` URLs): no server involved. Skipped when `svn` or `svnadmin` is //! not installed. -mod common; - -use common::*; +use crate::common::*; use ide_core::CancellationToken; use ide_core::error::ErrorKind; use ide_svn::{ResolveAccept, WorkingCopy}; diff --git a/crates/ide-vcs/tests/blame_ignore.rs b/crates/ide-vcs/tests/integration/blame_ignore.rs similarity index 100% rename from crates/ide-vcs/tests/blame_ignore.rs rename to crates/ide-vcs/tests/integration/blame_ignore.rs diff --git a/crates/ide-vcs/tests/block_history.rs b/crates/ide-vcs/tests/integration/block_history.rs similarity index 100% rename from crates/ide-vcs/tests/block_history.rs rename to crates/ide-vcs/tests/integration/block_history.rs diff --git a/crates/ide-vcs/tests/case_rename.rs b/crates/ide-vcs/tests/integration/case_rename.rs similarity index 100% rename from crates/ide-vcs/tests/case_rename.rs rename to crates/ide-vcs/tests/integration/case_rename.rs diff --git a/crates/ide-vcs/tests/git_workflows.rs b/crates/ide-vcs/tests/integration/git_workflows.rs similarity index 100% rename from crates/ide-vcs/tests/git_workflows.rs rename to crates/ide-vcs/tests/integration/git_workflows.rs diff --git a/crates/ide-vcs/tests/history_ops.rs b/crates/ide-vcs/tests/integration/history_ops.rs similarity index 100% rename from crates/ide-vcs/tests/history_ops.rs rename to crates/ide-vcs/tests/integration/history_ops.rs diff --git a/crates/ide-vcs/tests/ignore.rs b/crates/ide-vcs/tests/integration/ignore.rs similarity index 100% rename from crates/ide-vcs/tests/ignore.rs rename to crates/ide-vcs/tests/integration/ignore.rs diff --git a/crates/ide-vcs/tests/lfs.rs b/crates/ide-vcs/tests/integration/lfs.rs similarity index 100% rename from crates/ide-vcs/tests/lfs.rs rename to crates/ide-vcs/tests/integration/lfs.rs diff --git a/crates/ide-vcs/tests/log_lock.rs b/crates/ide-vcs/tests/integration/log_lock.rs similarity index 99% rename from crates/ide-vcs/tests/log_lock.rs rename to crates/ide-vcs/tests/integration/log_lock.rs index e14622842e..d0ac54764e 100644 --- a/crates/ide-vcs/tests/log_lock.rs +++ b/crates/ide-vcs/tests/integration/log_lock.rs @@ -1,6 +1,5 @@ //! A long file history walk must not hold the log index while Git runs: commit details and //! one-commit queries (inline blame, the blame popup) share that index. -#![cfg(unix)] use ide_vcs::{LogQuery, Repo}; use std::os::unix::fs::PermissionsExt; diff --git a/crates/ide-vcs/tests/log_projection.rs b/crates/ide-vcs/tests/integration/log_projection.rs similarity index 100% rename from crates/ide-vcs/tests/log_projection.rs rename to crates/ide-vcs/tests/integration/log_projection.rs diff --git a/crates/ide-vcs/tests/log_shape.rs b/crates/ide-vcs/tests/integration/log_shape.rs similarity index 100% rename from crates/ide-vcs/tests/log_shape.rs rename to crates/ide-vcs/tests/integration/log_shape.rs diff --git a/crates/ide-vcs/tests/integration/main.rs b/crates/ide-vcs/tests/integration/main.rs new file mode 100644 index 0000000000..fe3f4b3a6c --- /dev/null +++ b/crates/ide-vcs/tests/integration/main.rs @@ -0,0 +1,17 @@ +mod blame_ignore; +mod block_history; +mod case_rename; +mod git_workflows; +mod history_ops; +mod ignore; +mod lfs; +#[cfg(unix)] +mod log_lock; +mod log_projection; +mod log_shape; +mod partial_clone; +mod repo; +mod stash_paths; +mod submodule_update; +#[cfg(target_os = "macos")] +mod volume_loss; diff --git a/crates/ide-vcs/tests/partial_clone.rs b/crates/ide-vcs/tests/integration/partial_clone.rs similarity index 100% rename from crates/ide-vcs/tests/partial_clone.rs rename to crates/ide-vcs/tests/integration/partial_clone.rs diff --git a/crates/ide-vcs/tests/repo.rs b/crates/ide-vcs/tests/integration/repo.rs similarity index 100% rename from crates/ide-vcs/tests/repo.rs rename to crates/ide-vcs/tests/integration/repo.rs diff --git a/crates/ide-vcs/tests/stash_paths.rs b/crates/ide-vcs/tests/integration/stash_paths.rs similarity index 100% rename from crates/ide-vcs/tests/stash_paths.rs rename to crates/ide-vcs/tests/integration/stash_paths.rs diff --git a/crates/ide-vcs/tests/submodule_update.rs b/crates/ide-vcs/tests/integration/submodule_update.rs similarity index 100% rename from crates/ide-vcs/tests/submodule_update.rs rename to crates/ide-vcs/tests/integration/submodule_update.rs diff --git a/crates/ide-vcs/tests/volume_loss.rs b/crates/ide-vcs/tests/integration/volume_loss.rs similarity index 99% rename from crates/ide-vcs/tests/volume_loss.rs rename to crates/ide-vcs/tests/integration/volume_loss.rs index b1e469dce9..9e55c1ece8 100644 --- a/crates/ide-vcs/tests/volume_loss.rs +++ b/crates/ide-vcs/tests/integration/volume_loss.rs @@ -1,8 +1,6 @@ //! Status after the repository's volume disappears. A stale memory-mapped pack index raises //! SIGBUS there, which kills the process instead of failing the call. -#![cfg(target_os = "macos")] - use ide_vcs::Repo; use std::path::{Path, PathBuf}; use std::process::{Command, Output}; diff --git a/crates/ide-workspace/tests/documents.rs b/crates/ide-workspace/tests/integration/documents.rs similarity index 100% rename from crates/ide-workspace/tests/documents.rs rename to crates/ide-workspace/tests/integration/documents.rs diff --git a/crates/ide-workspace/tests/file_operations.rs b/crates/ide-workspace/tests/integration/file_operations.rs similarity index 100% rename from crates/ide-workspace/tests/file_operations.rs rename to crates/ide-workspace/tests/integration/file_operations.rs diff --git a/crates/ide-workspace/tests/integration/main.rs b/crates/ide-workspace/tests/integration/main.rs new file mode 100644 index 0000000000..56558aeeb9 --- /dev/null +++ b/crates/ide-workspace/tests/integration/main.rs @@ -0,0 +1,4 @@ +mod documents; +mod file_operations; +mod workspace_edits; +mod write_load_invariant; diff --git a/crates/ide-workspace/tests/workspace_edits.rs b/crates/ide-workspace/tests/integration/workspace_edits.rs similarity index 100% rename from crates/ide-workspace/tests/workspace_edits.rs rename to crates/ide-workspace/tests/integration/workspace_edits.rs diff --git a/crates/ide-workspace/tests/write_load_invariant.rs b/crates/ide-workspace/tests/integration/write_load_invariant.rs similarity index 100% rename from crates/ide-workspace/tests/write_load_invariant.rs rename to crates/ide-workspace/tests/integration/write_load_invariant.rs diff --git a/docs/en/contribute/testing/unit-e2e.mdx b/docs/en/contribute/testing/unit-e2e.mdx index 0a3c07056d..986267ba4e 100644 --- a/docs/en/contribute/testing/unit-e2e.mdx +++ b/docs/en/contribute/testing/unit-e2e.mdx @@ -15,7 +15,7 @@ description: "Running and writing Rust tests with cargo nextest, frontend tests ```sh cargo nextest run --workspace # everything, as CI does cargo nextest run -p ide-text # one crate -cargo nextest run -p ide-host --test vcs_flow # one integration test file +cargo nextest run -p ide-host --test integration vcs_flow:: # one integration test module ``` - Unit tests sit next to the code (`#[cfg(test)]` modules or a `tests.rs`); integration tests in `crates//tests/`. `ide-host` has the most: opening projects, trust, VCS flows, run configurations, plugins, the remote protocol. diff --git a/docs/en/plugins/guides/indexing.mdx b/docs/en/plugins/guides/indexing.mdx index 823cbfbb7a..2d4c8e8322 100644 --- a/docs/en/plugins/guides/indexing.mdx +++ b/docs/en/plugins/guides/indexing.mdx @@ -157,7 +157,7 @@ and the others are skipped. To try the fixture, build it with `plugins/build.sh crates/ide-plugin/tests/fixtures/indexer` and load the folder as a development plugin in a trusted project with `.idx` files; its -README lists the steps. `cargo test -p ide-host --test plugin_indexing` runs the real +README lists the steps. `cargo test -p ide-host --test integration plugin_indexing::` runs the real component contract checks. ## Project HTTP endpoints (API 1.3) diff --git a/docs/zh/contribute/testing/unit-e2e.mdx b/docs/zh/contribute/testing/unit-e2e.mdx index ae1bb6308f..519dc8234b 100644 --- a/docs/zh/contribute/testing/unit-e2e.mdx +++ b/docs/zh/contribute/testing/unit-e2e.mdx @@ -15,7 +15,7 @@ description: "用 cargo nextest 运行和编写 Rust 测试,用 Vitest 测前 ```sh cargo nextest run --workspace # 全部,与 CI 相同 cargo nextest run -p ide-text # 单个 crate -cargo nextest run -p ide-host --test vcs_flow # 单个集成测试文件 +cargo nextest run -p ide-host --test integration vcs_flow:: # 单个集成测试模块 ``` - 单元测试放在代码旁边(`#[cfg(test)]` 模块或 `tests.rs`);集成测试放在 `crates//tests/`。`ide-host` 的集成测试最多:打开项目、信任、VCS 流程、运行配置、插件、远程协议。 diff --git a/docs/zh/plugins/guides/indexing.mdx b/docs/zh/plugins/guides/indexing.mdx index 36c867a601..4cf674d5d2 100644 --- a/docs/zh/plugins/guides/indexing.mdx +++ b/docs/zh/plugins/guides/indexing.mdx @@ -133,7 +133,7 @@ tooltip = "Usages of this class" # 1–256 字节,显示在目标列表上 16 张项目/窗口图,每次查找 256 个候选。超过限制的文档不会被索引;编辑永远不会被阻塞。项目更大时,关联图按路径顺序覆盖前 20,000 个匹配文件,其余文件会被跳过。 想试用测试插件,可以用 `plugins/build.sh crates/ide-plugin/tests/fixtures/indexer` 构建,然后在包含 `.idx` -文件的受信任项目中把该目录作为开发插件加载,具体步骤见其 README。`cargo test -p ide-host --test plugin_indexing` +文件的受信任项目中把该目录作为开发插件加载,具体步骤见其 README。`cargo test -p ide-host --test integration plugin_indexing::` 会运行真实组件的契约测试。 ## 项目 HTTP 端点(API 1.3) diff --git a/plugins/indexing.md b/plugins/indexing.md index 9231d690db..5cb0a8a369 100644 --- a/plugins/indexing.md +++ b/plugins/indexing.md @@ -98,7 +98,7 @@ needed. Unindexed names continue through the normal language-server path. `crates/ide-plugin/tests/fixtures/indexer` uses a tiny line-oriented `.idx` language to exercise definitions, references, aliases, markers and host syntax symbols without framework-specific parsing. Run -`cargo test -p ide-host --test plugin_indexing` for the real-component contract +`cargo test -p ide-host --test integration plugin_indexing::` for the real-component contract checks. Framework plugins (MyBatis mappers, Rails routes) belong in their authors' diff --git a/scripts/smoke-paths.test.ts b/scripts/smoke-paths.test.ts index 38e4670d6c..6b3138691c 100644 --- a/scripts/smoke-paths.test.ts +++ b/scripts/smoke-paths.test.ts @@ -9,6 +9,7 @@ import { describeUnselected, filterPattern, importClosure, + matchesPathFilters, readWorkflow, rustSmokeInputs, selectedLanguages, @@ -130,6 +131,19 @@ describe("GitHub path filters", () => { expect(filterPattern("package.json").test("packageXjson")).toBe(false); }); + it("evaluates negated filters in order like GitHub Actions", () => { + const globs = [ + "src/platform/**", + "!src/platform/locales/text/**", + "!src/platform/locales/*.json", + "src/platform/locales/en.json", + ]; + expect(matchesPathFilters(globs, "src/platform/ipc.ts")).toBe(true); + expect(matchesPathFilters(globs, "src/platform/locales/text/en.json")).toBe(false); + expect(matchesPathFilters(globs, "src/platform/locales/zh.json")).toBe(false); + expect(matchesPathFilters(globs, "src/platform/locales/en.json")).toBe(true); + }); + it("refuse syntax the check does not model", () => { expect(() => filterPattern("!src/**")).toThrow(); expect(() => filterPattern("src/?.ts")).toThrow(); diff --git a/scripts/smoke-paths.ts b/scripts/smoke-paths.ts index 0fc55a8ada..a43475733d 100644 --- a/scripts/smoke-paths.ts +++ b/scripts/smoke-paths.ts @@ -242,6 +242,17 @@ export function filterPattern(glob: string): RegExp { ); } +/** GitHub Actions evaluates `paths` in order: positive globs include, `!` globs exclude. */ +export function matchesPathFilters(globs: string[], path: string): boolean { + let matched = false; + for (const glob of globs) { + const negated = glob.startsWith("!"); + const pattern = filterPattern(negated ? glob.slice(1) : glob); + if (pattern.test(path)) matched = !negated; + } + return matched; +} + /** The test files the workflow's `pnpm smoke` steps run. */ export function smokeTestFiles(workflow: Workflow): string[] { const files = new Set(); @@ -346,9 +357,9 @@ export async function unselected(workflow: Workflow, paths: string[]): Promise(); const flag = (path: string, reason: string) => reasons.set(path, [...(reasons.get(path) ?? []), reason]); for (const event of ["pull_request", "push"]) { - const filters = workflow.on[event]?.paths?.map(filterPattern); - if (!filters) continue; - for (const path of paths) if (!filters.some((filter) => filter.test(path))) flag(path, `not in on.${event}.paths`); + const globs = workflow.on[event]?.paths; + if (!globs) continue; + for (const path of paths) if (!matchesPathFilters(globs, path)) flag(path, `not in on.${event}.paths`); } const { all, smoke, unused } = await changesPatterns(workflow, paths); @@ -408,6 +419,16 @@ export async function smokeInputs(root: string, workflow: Workflow): Promise(); @@ -495,9 +516,9 @@ if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1] const workflow = readWorkflow(root); const asked = process.argv.slice(2); if (asked.length) { - const filters = workflow.on.pull_request?.paths?.map(filterPattern); + const globs = workflow.on.pull_request?.paths; for (const [path, languages] of await selectedLanguages(workflow, asked)) { - const triggered = !filters || filters.some((filter) => filter.test(path)); + const triggered = !globs || matchesPathFilters(globs, path); console.log(`${path}: ${triggered ? languages.join(" ") || "no language" : "not in on.pull_request.paths"}`); } } else { diff --git a/src/test/setup.ts b/src/test/setup.ts index 6a70e95905..1c8d35dcb8 100644 --- a/src/test/setup.ts +++ b/src/test/setup.ts @@ -1,11 +1,11 @@ -import "@testing-library/jest-dom/vitest"; -import { afterEach } from "vitest"; -import { cleanup } from "@testing-library/react"; - -afterEach(() => cleanup()); +export {}; // jsdom has no layout: give elements a size so virtualized lists render rows. +// Skip DOM/React testing imports for `// @vitest-environment node` files. if (typeof window !== "undefined") { + await import("@testing-library/jest-dom/vitest"); + const [{ afterEach }, { cleanup }] = await Promise.all([import("vitest"), import("@testing-library/react")]); + afterEach(() => cleanup()); // jsdom's user agent names the host OS; tests are written for macOS (⌘ keymaps) and opt into Windows explicitly. Object.defineProperty(window.navigator, "userAgent", { configurable: true, diff --git a/vite.config.ts b/vite.config.ts index 05bfa12683..b1d4535abd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -124,6 +124,7 @@ export default defineConfig(() => ({ sourcemap: true, }, test: { + pool: "threads", environment: "jsdom", globals: false, setupFiles: ["./src/test/setup.ts"],