Commit 512ad28
committed
fix(@schematics/angular): preserve blank lines in jasmine-to-vitest schematic
The TypeScript printer, by design, does not retain blank lines. This caused the jasmine-to-vitest refactoring schematic to produce code that lost the original file's vertical spacing, harming readability.
This commit introduces a pre- and post-processing step within the main transformation function. Before parsing, blank lines are converted into unique placeholder comments. After the TypeScript printer generates the new code, these placeholders are converted back into blank lines, ensuring that the vertical formatting of the original file is preserved in the transformed output.1 parent 78507f4 commit 512ad28
File tree
2 files changed
+21
-5
lines changed- packages/schematics/angular/refactor/jasmine-vitest
2 files changed
+21
-5
lines changedLines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 19 | + | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
| |||
Lines changed: 20 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
44 | 59 | | |
45 | 60 | | |
46 | 61 | | |
| |||
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
| 71 | + | |
| 72 | + | |
56 | 73 | | |
57 | 74 | | |
58 | | - | |
| 75 | + | |
59 | 76 | | |
60 | 77 | | |
61 | 78 | | |
| |||
151 | 168 | | |
152 | 169 | | |
153 | 170 | | |
| 171 | + | |
154 | 172 | | |
155 | | - | |
| 173 | + | |
156 | 174 | | |
0 commit comments