Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Sep 8, 2025

Summary

Addressed #7414: This is not a functional change, but adds tests and tweaks the wording in the changeset to verify and clarify that force-ignoring can also be used to ignore nested biome.json files.

Test Plan

Tests are added.

Docs

See biomejs/website#3072

@arendjr arendjr requested review from a team September 8, 2025 10:56
@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2025

⚠️ No Changeset found

Latest commit: 37b20dd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 15 packages
Name Type
@biomejs/biome Minor
@biomejs/plugin-api Major
@biomejs/cli-win32-x64 Minor
@biomejs/cli-win32-arm64 Minor
@biomejs/cli-darwin-x64 Minor
@biomejs/cli-darwin-arm64 Minor
@biomejs/cli-linux-x64 Minor
@biomejs/cli-linux-arm64 Minor
@biomejs/cli-linux-x64-musl Minor
@biomejs/cli-linux-arm64-musl Minor
@biomejs/wasm-web Minor
@biomejs/wasm-bundler Minor
@biomejs/wasm-nodejs Minor
@biomejs/backend-jsonrpc Patch
@biomejs/js-api Major

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 8, 2025

Walkthrough

Updates force-ignore documentation to include Biome-treated files (e.g., nested biome.json) in force-ignoring semantics. Migrates included-files tests to a dynamic filesystem by using TemporaryFs and run_cli_with_dyn_fs instead of MemoryFileSystem. Adds tests errors_on_ignored_nested_biome_json and can_force_ignore_biome_json that construct TemporaryFs setups with includes patterns referencing nested biome.json, run the CLI, expect errors, and snapshot outputs. Introduces public run_cli_with_dyn_fs in the biome_cli crate and public TemporaryFs in the biome_fs crate. No exported/public API removals.

Possibly related PRs

Suggested labels

A-CLI, A-Project

Suggested reviewers

  • ematipico
  • siketyan
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the A-CLI Area: CLI label Sep 8, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.changeset/forced-files-forget.md (1)

9-9: Prefer present tense for current behaviour.

Changeset guidelines ask for present tense when describing Biome’s behaviour. Suggest tightening “will not index” to “does not index”.

-The effect of force-ignoring is that the scanner will not index files matching the glob, even in project mode, even if those files are imported by other files, and even if they are files that receive special treatment by Biome, such as nested `biome.json` files.
+The effect of force-ignoring is that the scanner does not index files matching the glob, even in project mode, even when those files are imported by other files, and even for files that receive special treatment by Biome, such as nested `biome.json` files.
crates/biome_cli/tests/cases/included_files.rs (1)

169-203: Keep test intent; consider parity with other tests and tiny cleanup.

  • Optional: add “--write” for parity with neighbouring format tests (avoids behaviour differences if defaults change).
  • Nit: inline the file paths; the locals aren’t reused.
@@
-    let root_a = "a.js";
-    fs.create_file(root_a, UNFORMATTED);
+    fs.create_file("a.js", UNFORMATTED);
@@
-    let nested_a = "nested/a.js";
-    fs.create_file(nested_a, UNFORMATTED);
+    fs.create_file("nested/a.js", UNFORMATTED);
@@
-        Args::from(["format", fs.cli_path()].as_slice()),
+        Args::from(["format", "--write", fs.cli_path()].as_slice()),
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4feb8e and 37b20dd.

⛔ Files ignored due to path filters (2)
  • crates/biome_cli/tests/snapshots/main_cases_included_files/can_force_ignore_biome_json.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_included_files/errors_on_ignored_nested_biome_json.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (2)
  • .changeset/forced-files-forget.md (1 hunks)
  • crates/biome_cli/tests/cases/included_files.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: In changeset files, only use #### or ##### headers; avoid other header levels
Changeset descriptions should use past tense for what you did (e.g., "Added...")
Describe current Biome behavior in present tense within changesets (e.g., "Biome now supports...")
For bug fixes in changesets, start with a link to the issue (e.g., "Fixed #1234: ...")
When referencing rules or assists in changesets, include links to their documentation pages
Include a minimal code block in the changeset when applicable to demonstrate the change
End every sentence in the changeset description with a period

Files:

  • .changeset/forced-files-forget.md
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_cli/tests/cases/included_files.rs
**/tests/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place test files under a tests/ directory in each crate

Files:

  • crates/biome_cli/tests/cases/included_files.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format all Rust source files before committing (just f)

Files:

  • crates/biome_cli/tests/cases/included_files.rs
🧠 Learnings (9)
📚 Learning: 2025-09-07T17:35:00.490Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.490Z
Learning: Applies to .changeset/*.md : Describe current Biome behavior in present tense within changesets (e.g., "Biome now supports...")

Applied to files:

  • .changeset/forced-files-forget.md
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in biome_lsp’s server.tests.rs

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Place watcher tests for workspace methods in src/workspace/watcher.tests.rs

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-17T08:55:30.118Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-17T08:55:30.118Z
Learning: Applies to **/tests/specs/**/*.snap : Use snapshot spec tests stored as .snap files under tests/specs/ (via cargo insta)

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use quick_test.rs for ad-hoc testing; set RuleFilter to the rule (e.g., RuleFilter::Rule("nursery", "useAwesomeTrick")) and adjust SOURCE

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: For debugging: run commands against the daemon (e.g., `cargo run --bin=biome -- lint --use-server <path>`)

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: For debugging: start the daemon with `cargo run --bin=biome -- start` and inspect logs in the cache folder

Applied to files:

  • crates/biome_cli/tests/cases/included_files.rs
🧬 Code graph analysis (1)
crates/biome_cli/tests/cases/included_files.rs (2)
crates/biome_cli/tests/main.rs (2)
  • run_cli (332-347)
  • run_cli_with_dyn_fs (351-395)
crates/biome_cli/tests/snap_test.rs (1)
  • assert_cli_snapshot (407-409)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: autofix
🔇 Additional comments (2)
crates/biome_cli/tests/cases/included_files.rs (2)

2-2: Import looks good.

Brings in the dyn-fs runner needed by the new tests.


4-4: Import looks good.

TemporaryFs is appropriate for exercising the CLI with an OS-backed FS.

Comment on lines +205 to +239
#[test]
fn can_force_ignore_biome_json() {
let mut console = BufferConsole::default();
let mut fs = TemporaryFs::new("can_force_ignore_biome_json");
fs.create_file(
"biome.json",
r#"{ "files": { "includes": ["**/*.js", "!!nested/biome.json"] } }"#,
);
fs.create_file(
"nested/biome.json",
r#"{ "formatter": { "enabled": false } }"#,
);

let root_a = "a.js";
fs.create_file(root_a, UNFORMATTED);

let nested_a = "nested/a.js";
fs.create_file(nested_a, UNFORMATTED);

let result = run_cli_with_dyn_fs(
Box::new(fs.create_os()),
&mut console,
Args::from(["format", fs.cli_path()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"can_force_ignore_biome_json",
fs.create_mem(),
console,
result,
));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Assertion contradicts the test name and changeset semantics.

Force-ignoring nested biome.json should be allowed; this test should pass, not error.

@@
-    let root_a = "a.js";
-    fs.create_file(root_a, UNFORMATTED);
+    fs.create_file("a.js", UNFORMATTED);
@@
-    let nested_a = "nested/a.js";
-    fs.create_file(nested_a, UNFORMATTED);
+    fs.create_file("nested/a.js", UNFORMATTED);
@@
-    let result = run_cli_with_dyn_fs(
+    let result = run_cli_with_dyn_fs(
         Box::new(fs.create_os()),
         &mut console,
-        Args::from(["format", fs.cli_path()].as_slice()),
+        Args::from(["format", "--write", fs.cli_path()].as_slice()),
     );
@@
-    assert!(result.is_err(), "run_cli returned {result:?}");
+    assert!(result.is_ok(), "run_cli returned {result:?}");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[test]
fn can_force_ignore_biome_json() {
let mut console = BufferConsole::default();
let mut fs = TemporaryFs::new("can_force_ignore_biome_json");
fs.create_file(
"biome.json",
r#"{ "files": { "includes": ["**/*.js", "!!nested/biome.json"] } }"#,
);
fs.create_file(
"nested/biome.json",
r#"{ "formatter": { "enabled": false } }"#,
);
let root_a = "a.js";
fs.create_file(root_a, UNFORMATTED);
let nested_a = "nested/a.js";
fs.create_file(nested_a, UNFORMATTED);
let result = run_cli_with_dyn_fs(
Box::new(fs.create_os()),
&mut console,
Args::from(["format", fs.cli_path()].as_slice()),
);
assert!(result.is_err(), "run_cli returned {result:?}");
assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"can_force_ignore_biome_json",
fs.create_mem(),
console,
result,
));
}
#[test]
fn can_force_ignore_biome_json() {
let mut console = BufferConsole::default();
let mut fs = TemporaryFs::new("can_force_ignore_biome_json");
fs.create_file(
"biome.json",
r#"{ "files": { "includes": ["**/*.js", "!!nested/biome.json"] } }"#,
);
fs.create_file(
"nested/biome.json",
r#"{ "formatter": { "enabled": false } }"#,
);
fs.create_file("a.js", UNFORMATTED);
fs.create_file("nested/a.js", UNFORMATTED);
let result = run_cli_with_dyn_fs(
Box::new(fs.create_os()),
&mut console,
Args::from(["format", "--write", fs.cli_path()].as_slice()),
);
assert!(result.is_ok(), "run_cli returned {result:?}");
assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"can_force_ignore_biome_json",
fs.create_mem(),
console,
result,
));
}
🤖 Prompt for AI Agents
crates/biome_cli/tests/cases/included_files.rs around lines 205 to 239: the test
name and comment indicate force-ignoring nested biome.json should succeed, but
the test currently asserts result.is_err(), causing it to expect failure; change
the assertion to expect success (e.g., assert!(result.is_ok())) and adjust any
subsequent handling of result when passing to assert_cli_snapshot (pass the Ok
value or keep passing result but update snapshot expectations) so the test
reflects a successful run instead of an error.

@arendjr arendjr merged commit ed025cd into biomejs:next Sep 8, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants