Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ export function createProvideZonelessForTestsSetupPrompt(testFilePath: string):

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\`.

* If there is already an import from \`@angular/core\`, add \`provideZonelessChangeDetection\` to the existing import.
* Otherwise, add a new import statement for \`provideZonelessChangeDetection\` from \`@angular/core\`.

\`\`\`diff
+ import { provideZonelessChangeDetection } from '@angular/core';
- import {{ SomeImport }} from '@angular/core';
+ import {{ SomeImport, provideZonelessChangeDetection }} from '@angular/core';

describe('MyComponent', () => {
+ beforeEach(() => {
Expand Down Expand Up @@ -202,6 +206,9 @@ export async function createFixResponseForZoneTests(

The following usages of \`provideZoneChangeDetection\` must be removed:
${locations.map((loc) => `- ${loc}`).join('\n')}

After removing \`provideZoneChangeDetection\`, the tests will likely fail. Use this guide to diagnose and fix the failures.

${testDebuggingGuideText(sourceFile.fileName)}

### Final Step
Expand All @@ -214,8 +221,6 @@ function testDebuggingGuideText(fileName: string) {
return `
### Test Debugging Guide

After removing \`provideZoneChangeDetection\`, the tests will likely fail. Use this guide to diagnose and fix the failures.

1. **\`ExpressionChangedAfterItHasBeenCheckedError\`**:
* **Cause**: This error indicates that a value in a component's template was updated, but Angular was not notified to run change detection.
* **Solution**:
Expand Down