You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(@angular/cli): Improve zoneless migration prompts based on observed outcomes
After observing some results from the tool's prompts, I found some
improvements:
* if there was an existing import from '@angular/core' LLMs sometimes
chose to delete it and all preceding imports
* Moved the note about "remove provideZoneChangeDetection" to the
specific prompt where it's relevant. This was being used in the
final "non-actionable" prompts and resulted in LLMs choosing to delete
'provideZonelessChangeDetection' additions from previous iterations
(cherry picked from commit 3b06b28)
Copy file name to clipboardExpand all lines: packages/angular/cli/src/commands/mcp/tools/onpush-zoneless-migration/prompts.ts
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,12 @@ export function createProvideZonelessForTestsSetupPrompt(testFilePath: string):
25
25
26
26
In the main \`beforeEach\` block for the test suite (the one inside the top-level \`describe\`), add \`provideZonelessChangeDetection()\` to the providers array in \`TestBed.configureTestingModule\`.
27
27
28
+
* If there is already an import from \`@angular/core\`, add \`provideZonelessChangeDetection\` to the existing import.
29
+
* Otherwise, add a new import statement for \`provideZonelessChangeDetection\` from \`@angular/core\`.
30
+
28
31
\`\`\`diff
29
-
+ import { provideZonelessChangeDetection } from '@angular/core';
32
+
- import {{ SomeImport }} from '@angular/core';
33
+
+ import {{ SomeImport, provideZonelessChangeDetection }} from '@angular/core';
30
34
31
35
describe('MyComponent', () => {
32
36
+ beforeEach(() => {
@@ -202,6 +206,9 @@ export async function createFixResponseForZoneTests(
202
206
203
207
The following usages of \`provideZoneChangeDetection\` must be removed:
204
208
${locations.map((loc)=>`- ${loc}`).join('\n')}
209
+
210
+
After removing \`provideZoneChangeDetection\`, the tests will likely fail. Use this guide to diagnose and fix the failures.
211
+
205
212
${testDebuggingGuideText(sourceFile.fileName)}
206
213
207
214
### Final Step
@@ -214,8 +221,6 @@ function testDebuggingGuideText(fileName: string) {
214
221
return`
215
222
### Test Debugging Guide
216
223
217
-
After removing \`provideZoneChangeDetection\`, the tests will likely fail. Use this guide to diagnose and fix the failures.
0 commit comments