From aae4482c552eb297ad552366a12e73c43f425daf Mon Sep 17 00:00:00 2001 From: David Peter Date: Fri, 23 May 2025 10:44:46 +0200 Subject: [PATCH] [ty] Replace remaining knot.toml reference (#18269) ## Summary Fix remaining `knot.toml` reference and replace it with `ty.toml`. This change was probably still in flight while we renamed things. ## Test Plan Added a second assertion which ensures that the config file has any effect. --- crates/ty/tests/cli.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/ty/tests/cli.rs b/crates/ty/tests/cli.rs index c0a510a143..d42ab07b45 100644 --- a/crates/ty/tests/cli.rs +++ b/crates/ty/tests/cli.rs @@ -1454,10 +1454,10 @@ fn cli_config_args_toml_string_basic() -> anyhow::Result<()> { } #[test] -fn cli_config_args_overrides_knot_toml() -> anyhow::Result<()> { +fn cli_config_args_overrides_ty_toml() -> anyhow::Result<()> { let case = TestCase::with_files(vec![ ( - "knot.toml", + "ty.toml", r#" [terminal] error-on-warning = true @@ -1465,6 +1465,27 @@ fn cli_config_args_overrides_knot_toml() -> anyhow::Result<()> { ), ("test.py", r"print(x) # [unresolved-reference]"), ])?; + + // Exit code of 1 due to the setting in `ty.toml` + assert_cmd_snapshot!(case.command().arg("--warn").arg("unresolved-reference"), @r" + success: false + exit_code: 1 + ----- stdout ----- + warning[unresolved-reference]: Name `x` used when not defined + --> test.py:1:7 + | + 1 | print(x) # [unresolved-reference] + | ^ + | + info: rule `unresolved-reference` was selected on the command line + + Found 1 diagnostic + + ----- stderr ----- + WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors. + "); + + // Exit code of 0 because the `ty.toml` setting is overwritten by `--config` assert_cmd_snapshot!(case.command().arg("--warn").arg("unresolved-reference").arg("--config").arg("terminal.error-on-warning=false"), @r" success: true exit_code: 0