Skip to content

Commit

Permalink
test(format/html): reenable snapshot tests (#3979)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 authored Sep 19, 2024
1 parent 5f2287e commit b4d9d9e
Show file tree
Hide file tree
Showing 20 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/biome_html_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ biome_formatter_test = { workspace = true }
biome_fs = { workspace = true }
biome_html_parser = { workspace = true }
biome_parser = { workspace = true }
biome_service = { workspace = true }
biome_service = { workspace = true, features = ["experimental-html"] }
countme = { workspace = true, features = ["enable"] }
tests_macros = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion crates/biome_html_formatter/tests/prettier_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use biome_html_syntax::HtmlFileSource;

mod language;

tests_macros::gen_tests! {"tests/specs/prettier/**/*.html", crate::test_snapshot, "script"}
tests_macros::gen_tests! {"tests/specs/prettier/**/*.html", crate::test_snapshot, ""}

#[allow(dead_code)]
fn test_snapshot(input: &'static str, _: &str, _: &str, _: &str) {
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_html_formatter/tests/spec_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ mod language {
/// * `json/null` -> input: `tests/specs/json/null.json`, expected output: `tests/specs/json/null.json.snap`
/// * `null` -> input: `tests/specs/null.json`, expected output: `tests/specs/null.json.snap`
pub fn run(spec_input_file: &str, _expected_file: &str, test_directory: &str, _file_type: &str) {
let root_path = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/specs/"));
let root_path = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/specs/html"));

let Some(test_file) = SpecTestFile::try_from_file(spec_input_file, root_path, None) else {
return;
panic!("Failed to set up snapshot test");
};

let source_type: HtmlFileSource = test_file.input_file().as_path().try_into().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_html_formatter/tests/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ mod spec_test;
mod formatter {

mod html {
tests_macros::gen_tests! {"tests/specs/**/*.html", crate::spec_test::run, ""}
tests_macros::gen_tests! {"tests/specs/html/**/*.html", crate::spec_test::run, ""}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: attributes-break.html
info: attributes/break.html
---
# Input

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: attributes-no-break.html
info: attributes/no-break.html
---
# Input

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: attributes-self-closing.html
info: attributes/self-closing.html
---
# Input

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: attributes-single-quotes.html
info: attributes/single-quotes.html
---
# Input

Expand All @@ -25,4 +25,4 @@ Attribute Position: Auto
-----

```html
<img src="foo.png" alt='should keep "these" quotes' />```
<img src="foo.png'" alt='should keep "these" quotes' />```

0 comments on commit b4d9d9e

Please sign in to comment.