Skip to content

Commit

Permalink
fix(emit): regression - keep comments in emit (#23815)
Browse files Browse the repository at this point in the history
Closes #23814
  • Loading branch information
dsherret committed May 14, 2024
1 parent dda8979 commit 4ddc85e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub fn ts_config_to_transpile_and_emit_options(
},
deno_ast::EmitOptions {
inline_sources: options.inline_sources,
keep_comments: false,
keep_comments: true,
source_map,
source_map_file: None,
},
Expand Down
4 changes: 4 additions & 0 deletions tests/specs/run/keep_comments_ts/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "run main.ts",
"output": "main.out"
}
4 changes: 4 additions & 0 deletions tests/specs/run/keep_comments_ts/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function test() {
// this comment should be in output
return 1 + 1;
}
7 changes: 7 additions & 0 deletions tests/specs/run/keep_comments_ts/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function test() {
// this comment should be in output
return 1 + 1;
}

// should include the comments because people rely on this behavior
console.log(test.toString());
20 changes: 18 additions & 2 deletions tests/testdata/coverage/complex_expected.lcov
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ FNF:4
FNH:2
BRF:0
BRH:0
DA:1,1
DA:13,1
DA:14,1
DA:15,1
DA:16,1
DA:17,2
DA:18,2
DA:19,2
Expand All @@ -21,6 +26,9 @@ DA:24,2
DA:25,2
DA:26,2
DA:27,2
DA:29,1
DA:30,1
DA:31,1
DA:32,1
DA:33,1
DA:34,1
Expand All @@ -30,6 +38,8 @@ DA:38,2
DA:39,2
DA:40,2
DA:42,2
DA:44,1
DA:45,1
DA:46,0
DA:47,0
DA:48,0
Expand All @@ -39,13 +49,19 @@ DA:52,0
DA:53,0
DA:54,0
DA:56,0
DA:58,1
DA:59,1
DA:60,1
DA:62,1
DA:63,1
DA:64,0
DA:65,0
DA:66,0
DA:68,0
DA:70,1
DA:71,0
DA:73,1
DA:74,1
LH:21
LF:35
LH:37
LF:51
end_of_record
2 changes: 1 addition & 1 deletion tests/testdata/coverage/complex_expected.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cover [WILDCARD]/coverage/complex.ts ... 60.000% (21/35)
cover [WILDCARD]/coverage/complex.ts ... 72.549% (37/51)
46 | export function unused(
47 | foo: string,
48 | bar: string,
Expand Down

0 comments on commit 4ddc85e

Please sign in to comment.