-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Move server tests as integration tests #19522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
crates/ty_server/src/lib.rs
Outdated
| #[cfg(feature = "testing")] | ||
| pub mod test; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use assert_debug_snapshot instead so that we don't need the serde serialization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not pretty ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it? Isn't it almost the same as JSON (unless we add some manual implementations):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are required by the mock server implementation.
|
MichaReiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)