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

[Bug]: SyntaxError: The requested module '@angular/core/rxjs-interop' does not provide an export named 'toSignal' #2726

Open
harshal-99 opened this issue Sep 6, 2024 · 5 comments
Labels
🐛 Bug Confirmed Bug is confirmed

Comments

@harshal-99
Copy link

Version

^14.2.2

Steps to reproduce

import { provideHttpClient } from '@angular/common/http';
import { importProvidersFrom } from '@angular/core';
import { provideProtractorTestingSupport } from '@angular/platform-browser';
import { provideRouter } from '@angular/router';
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';

import { routes } from './app.routes';
import { InMemoryDataService } from './in-memory-data.service';
import { HeroService, UserService } from './model';
import { TwainService } from './twain/twain.service';
import { provideStore } from '@ngrx/store';
import { reducers, metaReducers } from './reducers';

export const appProviders = [
    provideRouter(routes),
    provideHttpClient(),
    provideProtractorTestingSupport(),
    importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(InMemoryDataService, { dataEncapsulation: false })),
    HeroService,
    TwainService,
    UserService,
    provideStore(reducers, { metaReducers }),
];

export const appConfig = {
    providers: appProviders,
};
  • run yarn test-esm

for all test you will get an error SyntaxError: The requested module '@angular/core/rxjs-interop' does not provide an export named 'toSignal'

Expected behavior

All tests to pass successfully if ngrx store is added

Actual behavior

after adding ngrx store tests fail

Additional context

None

Environment

System: 
  Apple M1 Mac
@LukasSefcik
Copy link

Is there any workaround for this error?

@harshal-99
Copy link
Author

Is there any workaround for this error?

Either use karma and Jasmine or don't use signal

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 13, 2024

This issue only happens if you use Jest in ESM mode. CJS mode works fine

@LukasSefcik
Copy link

Yes, CJS works just fine but is slow. I am trying to speed up my tests using experimental ESM mode.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Nov 13, 2024

I tried to investigate this issue a while ago. I couldn't get so far but it has to do something with Jest runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Confirmed Bug is confirmed
Projects
None yet
Development

No branches or pull requests

3 participants