Skip to content

fix: remove zoneless option #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
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
7 changes: 0 additions & 7 deletions projects/testing-library/src/lib/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,4 @@ export interface Config extends Pick<RenderComponentOptions<any>, 'excludeCompon
* Imports that are added to the imports
*/
defaultImports?: (Type<unknown> | ModuleWithProviders<unknown>)[];
/**
* Set to `true` to use zoneless change detection.
* This automatically adds `provideZonelessChangeDetection` to the default imports.
*
* @default false
*/
zoneless?: boolean;
}
15 changes: 1 addition & 14 deletions projects/testing-library/src/lib/testing-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
SimpleChanges,
Type,
isStandalone,
provideZonelessChangeDetection,
} from '@angular/core';
import { ComponentFixture, DeferBlockBehavior, DeferBlockState, TestBed, tick } from '@angular/core/testing';
import { NavigationExtras, Router } from '@angular/router';
Expand Down Expand Up @@ -80,7 +79,6 @@ export async function render<SutType, WrapperType = SutType>(
initialRoute = '',
deferBlockStates = undefined,
deferBlockBehavior = undefined,
zoneless = false,
configureTestBed = () => {
/* noop*/
},
Expand Down Expand Up @@ -109,10 +107,7 @@ export async function render<SutType, WrapperType = SutType>(
imports: imports.concat(defaultImports),
routes,
}),
providers: addAutoProviders({
providers: [...providers],
zoneless,
}),
providers,
schemas: [...schemas],
deferBlockBehavior: deferBlockBehavior ?? DeferBlockBehavior.Manual,
});
Expand Down Expand Up @@ -523,14 +518,6 @@ function addAutoImports<SutType>(
return [...imports, ...components(), ...routing()];
}

function addAutoProviders({
providers = [],
zoneless,
}: Pick<RenderTemplateOptions<any>, 'providers'> & Pick<Config, 'zoneless'>) {
const provideZoneless = () => (zoneless ? [provideZonelessChangeDetection()] : []);
return [...providers, ...provideZoneless()];
}

async function renderDeferBlock<SutType>(
fixture: ComponentFixture<SutType>,
deferBlockState: DeferBlockState,
Expand Down
Loading