-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
fix(biome_fs): configuration resolution
Showing
14 changed files
with
257 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use crate::run_cli; | ||
use crate::snap_test::{assert_cli_snapshot, SnapshotPayload}; | ||
use biome_console::BufferConsole; | ||
use biome_fs::MemoryFileSystem; | ||
use biome_service::DynRef; | ||
use bpaf::Args; | ||
use std::path::Path; | ||
|
||
#[test] | ||
fn set_config_path() { | ||
let mut fs = MemoryFileSystem::default(); | ||
let mut console = BufferConsole::default(); | ||
|
||
let file_path = Path::new("src/index.js"); | ||
fs.insert(file_path.into(), "a['b'] = 42;".as_bytes()); | ||
|
||
let config_path = Path::new("config/biome.jsonc"); | ||
fs.insert( | ||
config_path.into(), | ||
r#" | ||
{ | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": false | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single" | ||
} | ||
} | ||
}"# | ||
.as_bytes(), | ||
); | ||
|
||
let result = run_cli( | ||
DynRef::Borrowed(&mut fs), | ||
&mut console, | ||
Args::from([("check"), ("--config-path=config"), ("src")].as_slice()), | ||
); | ||
|
||
assert!(result.is_err(), "run_cli returned {result:?}"); | ||
|
||
assert_cli_snapshot(SnapshotPayload::new( | ||
module_path!(), | ||
"set_config_path", | ||
fs, | ||
console, | ||
result, | ||
)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
crates/biome_cli/tests/snapshots/main_cases_config_path/set_config_path.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
source: crates/biome_cli/tests/snap_test.rs | ||
expression: content | ||
--- | ||
## `config/biome.jsonc` | ||
|
||
```jsonc | ||
|
||
{ | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": false | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## `src/index.js` | ||
|
||
```js | ||
a['b'] = 42; | ||
``` | ||
|
||
# Termination Message | ||
|
||
```block | ||
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× Some errors were emitted while running checks. | ||
``` | ||
|
||
# Emitted Messages | ||
|
||
```block | ||
src/index.js format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
i Formatter would have printed the following content: | ||
1 │ - a['b']··=··42; | ||
1 │ + a['b']·=·42; | ||
2 │ + | ||
``` | ||
|
||
```block | ||
Checked 1 file in <TIME>. No fixes needed. | ||
Found 2 errors. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.