-
-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
92 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
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 should_use_editorconfig() { | ||
let mut fs = MemoryFileSystem::default(); | ||
let mut console = BufferConsole::default(); | ||
|
||
let editorconfig = Path::new(".editorconfig"); | ||
fs.insert( | ||
editorconfig.into(), | ||
r#" | ||
[*] | ||
max_line_length = 300 | ||
"#, | ||
); | ||
|
||
let test_file = Path::new("test.js"); | ||
fs.insert(test_file.into(), r#"console.log("really long string that should cause a break if the line width remains at the default 80 characters"); "#); | ||
|
||
let result = run_cli( | ||
DynRef::Borrowed(&mut fs), | ||
&mut console, | ||
Args::from([("check"), test_file.as_os_str().to_str().unwrap()].as_slice()), | ||
); | ||
|
||
assert!(result.is_err(), "run_cli returned {result:?}"); | ||
|
||
assert_cli_snapshot(SnapshotPayload::new( | ||
module_path!(), | ||
"should_use_editorconfig", | ||
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
50 changes: 50 additions & 0 deletions
50
crates/biome_cli/tests/snapshots/main_cases_editorconfig/should_use_editorconfig.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,50 @@ | ||
--- | ||
source: crates/biome_cli/tests/snap_test.rs | ||
expression: content | ||
--- | ||
## `.editorconfig` | ||
|
||
```editorconfig | ||
[*] | ||
max_line_length = 300 | ||
``` | ||
|
||
## `test.js` | ||
|
||
```js | ||
console.log("really long string that should cause a break if the line width remains at the default 80 characters"); | ||
``` | ||
|
||
# Termination Message | ||
|
||
```block | ||
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× Some errors were emitted while running checks. | ||
``` | ||
|
||
# Emitted Messages | ||
|
||
```block | ||
test.js format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× Formatter would have printed the following content: | ||
1 │ - console.log("really·long·string·that·should·cause·a·break·if·the·line·width·remains·at·the·default·80·characters");· | ||
1 │ + console.log( | ||
2 │ + → "really·long·string·that·should·cause·a·break·if·the·line·width·remains·at·the·default·80·characters", | ||
3 │ + ); | ||
4 │ + | ||
``` | ||
|
||
```block | ||
Checked 1 file in <TIME>. No fixes needed. | ||
Found 1 error. | ||
``` |