Skip to content
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

Make spectator zoneless-compatible #663

Open
devfservant opened this issue Jul 9, 2024 · 2 comments
Open

Make spectator zoneless-compatible #663

devfservant opened this issue Jul 9, 2024 · 2 comments

Comments

@devfservant
Copy link

Description

Since Angular 18, zoneless applications are available experimentally.
The main advantages are described here: https://angular.dev/guide/experimental/zoneless
It is possible to configure TestBed accordingly to ensure the components under test are zoneless-compatible:

TestBed.configureTestingModule({
  providers: [provideExperimentalZonelessChangeDetection()]
});

The spectator equivalent looks like:

const createComponent = createComponentFactory({
    component: MyComponent,
    providers: [provideExperimentalZonelessChangeDetection()],
  });

But, it does not work, as it uses waitForAsync under the hood:
https://github.com/ngneat/spectator/blob/v19.0.0/projects/spectator/src/lib/spectator/create-factory.ts#L127

MyComponent › should render
    thrown: "Zone is needed for the waitForAsync() test helper but could not be found. Please make sure that your environment includes zone.js"

It would be a huge improvement to see Spectator be zoneless-compatible.

Thanks for all your amazing work

Proposed solution

--

Alternatives considered

No alternative considerations.

Do you want to create a pull request?

No

@andrei4ik1997
Copy link

@NetanelBasal Hi, any updates on this issue?

@NetanelBasal
Copy link
Member

Hi, You're welcome to create a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants