Skip to content

Commit 7e1191a

Browse files
siketyanConaclos
authored andcommitted
test: use Manifest::read_manifest to insert tsconfig (#7832)
1 parent 27a5838 commit 7e1191a

File tree

1 file changed

+4
-13
lines changed
  • crates/biome_test_utils/src

1 file changed

+4
-13
lines changed

crates/biome_test_utils/src/lib.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use biome_js_parser::{AnyJsRoot, JsFileSource, JsParserOptions};
1616
use biome_js_type_info::{TypeData, TypeResolver};
1717
use biome_json_parser::{JsonParserOptions, ParseDiagnostic};
1818
use biome_module_graph::ModuleGraph;
19-
use biome_package::{PackageJson, TsConfigJson};
19+
use biome_package::{Manifest, PackageJson, TsConfigJson};
2020
use biome_project_layout::ProjectLayout;
2121
use biome_rowan::{Direction, Language, SyntaxKind, SyntaxNode, SyntaxSlot};
2222
use biome_service::file_handlers::DocumentFileSource;
@@ -212,14 +212,11 @@ pub fn project_layout_for_test_file(
212212
diagnostics: &mut Vec<String>,
213213
) -> Arc<ProjectLayout> {
214214
let project_layout = ProjectLayout::default();
215+
let fs = OsFileSystem::new(input_file.parent().unwrap().to_path_buf());
215216

216217
let package_json_file = input_file.with_extension("package.json");
217218
if let Ok(json) = std::fs::read_to_string(&package_json_file) {
218-
let deserialized = biome_deserialize::json::deserialize_from_json_str::<PackageJson>(
219-
json.as_str(),
220-
JsonParserOptions::default(),
221-
"",
222-
);
219+
let deserialized = PackageJson::read_manifest(&fs, &package_json_file);
223220
if deserialized.has_errors() {
224221
diagnostics.extend(
225222
deserialized
@@ -246,13 +243,7 @@ pub fn project_layout_for_test_file(
246243

247244
let tsconfig_file = input_file.with_extension("tsconfig.json");
248245
if let Ok(json) = std::fs::read_to_string(&tsconfig_file) {
249-
let deserialized = biome_deserialize::json::deserialize_from_json_str::<TsConfigJson>(
250-
json.as_str(),
251-
JsonParserOptions::default()
252-
.with_allow_comments()
253-
.with_allow_trailing_commas(),
254-
"",
255-
);
246+
let deserialized = TsConfigJson::read_manifest(&fs, &tsconfig_file);
256247
if deserialized.has_errors() {
257248
diagnostics.extend(
258249
deserialized

0 commit comments

Comments
 (0)