[ty] Move server tests as integration tests#19522
Conversation
|
crates/ty_server/src/lib.rs
Outdated
| #[cfg(feature = "testing")] | ||
| pub mod test; |
There was a problem hiding this comment.
I would move this implementation into the test folder too. See how I shared the comment CliTest infrastructure in ty/tests/cli
There was a problem hiding this comment.
I've pushed this change. I've moved the tests under e2e/ directory and moved the TestServer and related data structures to e2e/main.rs file.
| ty_server = { workspace = true, features = ["testing"] } | ||
|
|
||
| dunce = { workspace = true } | ||
| insta = { workspace = true, features = ["filters", "json"] } | ||
| regex = { workspace = true } | ||
| tempfile = { workspace = true } | ||
|
|
||
| [features] | ||
| testing = [] | ||
|
|
There was a problem hiding this comment.
This is still required because we conditionally add the serde::Serialize attribute to the ClientOptions and other nested structs.
There was a problem hiding this comment.
Could we use assert_debug_snapshot instead so that we don't need the serde serialization?
There was a problem hiding this comment.
That is not pretty ;)
There was a problem hiding this comment.
Is it? Isn't it almost the same as JSON (unless we add some manual implementations):
There was a problem hiding this comment.
I would also be fine to simply always derive Serialize for those types. It's not that many and it simplifies the crate setup
There was a problem hiding this comment.
Yeah, I think implementing Serialize unconditionally seems fine, I'll do it as a quick follow up tomorrow morning.
| pub use crate::logging::{LogLevel, init_logging}; | ||
| pub use crate::server::Server; | ||
| pub use crate::session::ClientOptions; |
There was a problem hiding this comment.
These are required by the mock server implementation.
|
| ty_server = { workspace = true, features = ["testing"] } | ||
|
|
||
| dunce = { workspace = true } | ||
| insta = { workspace = true, features = ["filters", "json"] } | ||
| regex = { workspace = true } | ||
| tempfile = { workspace = true } | ||
|
|
||
| [features] | ||
| testing = [] | ||
|
|
There was a problem hiding this comment.
Could we use assert_debug_snapshot instead so that we don't need the serde serialization?
…hlight * 'main' of https://github.com/astral-sh/ruff: [ty] Minor: fix incomplete docstring (astral-sh#19534) [ty] Move server tests as integration tests (astral-sh#19522) [`ruff`] Offer fixes for `RUF039` in more cases (astral-sh#19065) [ty] Support `dataclasses.InitVar` (astral-sh#19527) [`ruff`] Fix `RUF033` breaking with named default expressions (astral-sh#19115) Update pre-commit hook name (astral-sh#19530) Bump 0.12.5 (astral-sh#19528) [ty] Rename type_api => ty_extensions (astral-sh#19523) [ty] Added support for "go to references" in ty playground. (astral-sh#19516) [ty] Return a tuple spec from the iterator protocol (astral-sh#19496) [ty] Exhaustiveness checking & reachability for `match` statements (astral-sh#19508) [ty] Fix narrowing and reachability of class patterns with arguments (astral-sh#19512)
* main: [ty] Added support for "document highlights" language server feature. (astral-sh#19515) Add support for specifying minimum dots in detected string imports (astral-sh#19538) [ty] Minor: fix incomplete docstring (astral-sh#19534) [ty] Move server tests as integration tests (astral-sh#19522) [`ruff`] Offer fixes for `RUF039` in more cases (astral-sh#19065) [ty] Support `dataclasses.InitVar` (astral-sh#19527) [`ruff`] Fix `RUF033` breaking with named default expressions (astral-sh#19115) Update pre-commit hook name (astral-sh#19530) Bump 0.12.5 (astral-sh#19528) [ty] Rename type_api => ty_extensions (astral-sh#19523) [ty] Added support for "go to references" in ty playground. (astral-sh#19516) # Conflicts: # crates/ty_server/src/server/api/requests.rs # crates/ty_server/tests/e2e/snapshots/e2e__initialize__initialization.snap # crates/ty_server/tests/e2e/snapshots/e2e__initialize__initialization_with_workspace.snap
## Summary Reference: #19391 (comment)
Summary
Reference: #19391 (comment)