Skip to content

Commit

Permalink
chore: add test to ensure parsing only happens once on first load (de…
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed May 21, 2024
1 parent 9795637 commit ddb5449
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/cache/parsed_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ impl ParsedSourceCache {
if parsed_source.media_type() == media_type
&& parsed_source.text_info().text_str() == source.as_ref()
{
// note: message used tests
log::debug!("Removed parsed source: {}", specifier);
return Ok(parsed_source);
}
}
Expand Down
6 changes: 6 additions & 0 deletions tests/specs/run/no_reparse_first_load/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// ensures we don't reparse a source file when transpiling
// because it should have already been parsed by module analysis
{
"args": "run --log-level=debug main.ts",
"output": "main.out"
}
2 changes: 2 additions & 0 deletions tests/specs/run/no_reparse_first_load/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[WILDCARD]Removed parsed source: file:https:///[WILDLINE]/main.ts
[WILDCARD]
1 change: 1 addition & 0 deletions tests/specs/run/no_reparse_first_load/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello");

0 comments on commit ddb5449

Please sign in to comment.