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
Copy file name to clipboardExpand all lines: packages/angular/cli/src/commands/mcp/tools/onpush-zoneless-migration/prompts.ts
+4-13Lines changed: 4 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -54,17 +54,6 @@ export function createProvideZonelessForTestsSetupPrompt(testFilePath: string):
54
54
});
55
55
// ... rest of the test
56
56
});
57
-
58
-
// Example for a group of failing tests
59
-
describe('tests that require Zone.js', () => {
60
-
beforeEach(() => {
61
-
TestBed.configureTestingModule({
62
-
providers: [provideZoneChangeDetection()]
63
-
});
64
-
});
65
-
66
-
// ... all failing tests go here
67
-
});
68
57
\`\`\`
69
58
70
59
### IMPORTANT: Rules and Constraints
@@ -74,6 +63,7 @@ export function createProvideZonelessForTestsSetupPrompt(testFilePath: string):
74
63
2. **DO** add \`provideZoneChangeDetection()\` to the providers for each individual test or group of tests that fail after the change in Step 1.
75
64
3. **DO NOT** attempt to fix the logic of the failing tests at this stage. The goal is only to enable zoneless for the suite and isolate the incompatible tests.
76
65
4. **DO NOT** make any other changes to the test file or any application code.
66
+
5. **DO NOT** move tests around or create new describe blocks if it can be avoided. Changes are easier to review when code moves around less.
77
67
78
68
### Final Step
79
69
After you have applied all the required changes and followed all the rules, consult this tool again for the next steps in the migration process.`;
@@ -221,8 +211,9 @@ When running tests in a zoneless environment, you may encounter new types of fai
221
211
You must follow these rules without exception:
222
212
1. **DO** focus only on fixing the tests for the code in \`${fileOrDirPath}\`.
223
213
2. **DO** apply the solutions described in the debugging guide to fix test failures.
224
-
3. **DO NOT** make changes to application code unless it is to fix a bug revealed by the zoneless migration (e.g., converting a property to a signal to fix an \`ExpressionChangedAfterItHasBeenCheckedError\`).
225
-
4. **DO NOT** re-introduce \`provideZoneChangeDetection()\` into tests that are already using \`provideZonelessChangeDetection()\`.
214
+
3. **DO** update properties of test components to use signals. Tests often use plain objects and values and update the component state directly before calling \`fixture.detectChanges\`. This will not work and will result in \`ExpressionChangedAfterItHasBeenCheckedError\` because Angular was not notifed of the change.
215
+
4. **DO NOT** make changes to application code unless it is to fix a bug revealed by the zoneless migration (e.g., converting a property to a signal to fix an \`ExpressionChangedAfterItHasBeenCheckedError\`).
216
+
5. **DO NOT** re-introduce \`provideZoneChangeDetection()\` into tests that are already using \`provideZonelessChangeDetection()\`.
0 commit comments