Skip to content

Commit ffb19f7

Browse files
committed
test: order configuration files
1 parent 7fc052c commit ffb19f7

31 files changed

Lines changed: 121 additions & 134 deletions

File tree

crates/biome_cli/tests/snap_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(crate) struct CliSnapshot {
4242
/// the configuration, if set
4343
/// First string is the content
4444
/// Second string is the name
45-
pub configuration_list: Vec<(String, String)>,
45+
pub configuration_list: BTreeMap<String, String>,
4646
/// file name -> content
4747
pub files: BTreeMap<String, String>,
4848
/// messages written in console
@@ -55,7 +55,7 @@ impl CliSnapshot {
5555
pub fn from_result(result: Result<(), CliDiagnostic>) -> Self {
5656
Self {
5757
in_messages: InMessages::default(),
58-
configuration_list: vec![],
58+
configuration_list: BTreeMap::default(),
5959
files: BTreeMap::default(),
6060
messages: Vec::new(),
6161
termination: result.err().map(Error::from),
@@ -67,7 +67,7 @@ impl CliSnapshot {
6767
pub fn emit_content_snapshot(&self) -> String {
6868
let mut content = String::new();
6969

70-
for (configuration, file_name) in &self.configuration_list {
70+
for (file_name, configuration) in &self.configuration_list {
7171
let file_name = redact_snapshot(file_name).unwrap_or(file_name.into());
7272
let redacted = redact_snapshot(configuration).unwrap_or(String::new().into());
7373
let parsed = parse_json(
@@ -459,7 +459,7 @@ impl From<SnapshotPayload<'_>> for CliSnapshot {
459459
{
460460
cli_snapshot
461461
.configuration_list
462-
.push((content.to_string(), file.to_string()));
462+
.insert(file.to_string(), content.to_string());
463463
} else {
464464
cli_snapshot
465465
.files

crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_ok_from_npm_package.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
source: crates/biome_cli/tests/snap_test.rs
33
expression: redactor(content)
44
---
5-
## `node_modules/@shared/format/biome.json`
5+
## `biome.json`
66

77
```json
8-
{ "javascript": { "formatter": { "quoteStyle": "single" } } }
8+
{ "extends": ["@shared/format/biome", "@shared/linter/biome"] }
99
```
1010

11-
## `node_modules/@shared/linter/biome.jsonc`
11+
## `node_modules/@shared/format/biome.json`
1212

1313
```json
14-
{ "linter": { "enabled": false } }
14+
{ "javascript": { "formatter": { "quoteStyle": "single" } } }
1515
```
1616

17-
## `biome.json`
17+
## `node_modules/@shared/linter/biome.jsonc`
1818

1919
```json
20-
{ "extends": ["@shared/format/biome", "@shared/linter/biome"] }
20+
{ "linter": { "enabled": false } }
2121
```
2222

2323
## `node_modules/@shared/format/package.json`

crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_ok_from_npm_package_with_author_field.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
source: crates/biome_cli/tests/snap_test.rs
33
expression: redactor(content)
44
---
5-
## `node_modules/@shared/format/biome.json`
5+
## `biome.json`
66

77
```json
8-
{ "javascript": { "formatter": { "quoteStyle": "single" } } }
8+
{ "extends": ["@shared/format/biome", "@shared/linter/biome"] }
99
```
1010

11-
## `node_modules/@shared/linter/biome.jsonc`
11+
## `node_modules/@shared/format/biome.json`
1212

1313
```json
14-
{ "linter": { "enabled": false } }
14+
{ "javascript": { "formatter": { "quoteStyle": "single" } } }
1515
```
1616

17-
## `biome.json`
17+
## `node_modules/@shared/linter/biome.jsonc`
1818

1919
```json
20-
{ "extends": ["@shared/format/biome", "@shared/linter/biome"] }
20+
{ "linter": { "enabled": false } }
2121
```
2222

2323
## `node_modules/@shared/format/package.json`

crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_ok_from_npm_package_with_condition_names.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
source: crates/biome_cli/tests/snap_test.rs
33
expression: redactor(content)
44
---
5-
## `node_modules/@shared/format/biome.json`
5+
## `biome.json`
66

77
```json
8-
{ "javascript": { "formatter": { "quoteStyle": "single" } } }
8+
{ "extends": ["@shared/format", "@shared/linter/biome"] }
99
```
1010

11-
## `node_modules/@shared/linter/biome.jsonc`
11+
## `node_modules/@shared/format/biome.json`
1212

1313
```json
14-
{ "linter": { "enabled": false } }
14+
{ "javascript": { "formatter": { "quoteStyle": "single" } } }
1515
```
1616

17-
## `biome.json`
17+
## `node_modules/@shared/linter/biome.jsonc`
1818

1919
```json
20-
{ "extends": ["@shared/format", "@shared/linter/biome"] }
20+
{ "linter": { "enabled": false } }
2121
```
2222

2323
## `node_modules/@shared/format/package.json`

crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_two_levels_deep.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
source: crates/biome_cli/tests/snap_test.rs
33
expression: redactor(content)
44
---
5-
## `sub-project/sub-sub-project/biome.jsonc`
6-
7-
```json
8-
{
9-
"extends": ["../../biome.jsonc"],
10-
"root": false
11-
}
12-
```
13-
145
## `biome.jsonc`
156

167
```json
@@ -29,6 +20,15 @@ expression: redactor(content)
2920
}
3021
```
3122

23+
## `sub-project/sub-sub-project/biome.jsonc`
24+
25+
```json
26+
{
27+
"extends": ["../../biome.jsonc"],
28+
"root": false
29+
}
30+
```
31+
3232
## `sub-project/sub-sub-project/test.js`
3333

3434
```js

crates/biome_cli/tests/snapshots/main_cases_handle_astro_files/full_support.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/biome_cli/tests/snap_test.rs
3-
assertion_line: 520
43
expression: redactor(content)
54
---
65
## `biome.json`

crates/biome_cli/tests/snapshots/main_cases_handle_astro_files/return_in_template_expression_should_error.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/biome_cli/tests/snap_test.rs
3-
assertion_line: 520
43
expression: redactor(content)
54
---
65
## `biome.json`

crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/full_support.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/biome_cli/tests/snap_test.rs
3-
assertion_line: 520
43
expression: redactor(content)
54
---
65
## `biome.json`

crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/full_support_ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/biome_cli/tests/snap_test.rs
3-
assertion_line: 520
43
expression: redactor(content)
54
---
65
## `biome.json`

crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/full_support.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: crates/biome_cli/tests/snap_test.rs
3-
assertion_line: 520
43
expression: redactor(content)
54
---
65
## `biome.json`

0 commit comments

Comments
 (0)