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

error: ReferenceError: Cannot access 'My Store' before initialization\ #3468

Closed
mmcgee-aya opened this issue Feb 14, 2025 · 2 comments
Closed

Comments

@mmcgee-aya
Copy link

mmcgee-aya commented Feb 14, 2025

We often get this error when working with NGRX signal stores. All the test past with Angular NG TEST, We have excluded these test for wallaby, but i would like to get it figured out.. Any ideas to pursue would be helpful!!

wallaby log.txt

describe('PersonalInfoComponent', () => {
    let spectator: Spectator<PersonalInfoComponent>;

    const mockCandidateClient = createSpyObject(CandidateClient, {
        getCandidateProfile: jasmine
            .createSpy('getCandidateProfile')
            .and.returnValue(
                of({
                    firstName: 'Test',
                    lastName: 'User',
                    phone: '555-555-5555',
                    email: '[email protected]'
                } as EducationCandidateProfileDto)
            )
    });

    const mockActivatedRoute = createSpyObject(ActivatedRoute, {
        snapshot: {
            queryParams: {}
        }
    });

    const mockAyaSlideDialog = createSpyObject(AyaSlideDialog, {
        open: jasmine
            .createSpy('open')
            .and.returnValue({ afterClosed: () => of(true) })
    });

    const enableEmergencyContactSection = signal(false);
    const ldFeatureManagerMock: jasmine.SpyObj<LDFeatureManager> =
        jasmine.createSpyObj(LDFeatureManager, {
            // eslint-disable-next-line rxjs/finnish
            isEnabledSignal: enableEmergencyContactSection
        });

    const createComponent = createComponentFactory({
        component: PersonalInfoComponent,
        providers: [
            { provide: CandidateClient, useValue: mockCandidateClient },
            createMockResumeStore(),
            PersonalInfoStore,
            {
                provide: ActivatedRoute,
                useValue: mockActivatedRoute
            },
            { provide: LDFeatureManager, useValue: ldFeatureManagerMock },
            provideHttpClient(withInterceptorsFromDi()),
            provideHttpClientTesting()
        ]
    });

    beforeEach(() => {
        spectator = createComponent({
            providers: [
                {
                    provide: AyaSlideDialog,
                    useValue: mockAyaSlideDialog
                }
            ]
        });
        mockAyaSlideDialog.open.calls.reset();
    });

package.json

"wallaby": {
    "trace:":true,
    "tests": [     
      "src/app/**/*.spec.ts",      
      "!src/app/**/jobs.component.spec.ts",
      "!src/app/**/job-search-box-widget.component.spec.ts",
      "!src/app/**//saved-search-card.component.spec.ts",
      "!src/app/**/health-check.component.spec.ts",
      "!src/app/**/job-search-box-widget.component.spec.ts",
      "!src/app/**/dashboard.component.spec.ts",
      "!src/app/**/job-search-box-widget.component.spec.ts",
      "!src/app/**/application-verification.component.spec.ts",
      "!src/app/**/recommended-jobs-widget.component.spec.ts",
      "!src/app/**/salary-range.component.spec.ts",
      "!src/app/**/addresses-edit.component.spec.ts",
      "!src/app/**/job-preferences-edit.component.spec.ts",
      "!src/app/**/my-jobs.store.spec.ts",
      "!src/app/**/resume-upload-progress-container.directive.spec.ts",
      "!src/app/**/addresses.component.spec.ts",     
      "!src/app/**/job-preferences.component.spec.ts"                          
    ]
  }
"2025-02-14T01:16:08.690Z workers Sandbox (active) [nnsvq] error: ReferenceError: Cannot access 'PersonalInfoStore' before initialization\n" +
      '    at Module.PersonalInfoStore (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:5029:64)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:258554:85\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:258570:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:199395:76\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:199533:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:44726:69\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:44854:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:185618:69\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:185910:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:7423:75\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:7508:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:234187:74\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:234289:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:107937:84\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:107964:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:5036:78\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:5297:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:73228:78\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:73388:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/src/app/profile/personal-info/personal-info.component.spec.ts.wbp.js?1739495762511&wallabyFileId=190:3:82\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/src/app/profile/personal-info/personal-info.component.spec.ts.wbp.js?1739495762511&wallabyFileId=190:165:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-webpack-bootstrapper.js?1739495764187:19:36\n' +
      '    at http://localhost:57630/__wallaby__/tracer.js:14:54248\n' +
      '    at o._doWhenReceiverIsReady (http://localhost:57630/__wallaby__/tracer.js:14:12016)\n' +
      '    at Object._startWhenReceiverIsReady (http://localhost:57630/__wallaby__/tracer.js:14:54214)\n' +
      '    at window.__moduleBundler.loadTests (http://localhost:57630/____wallaby-webpack-bootstrapper.js?1739495764187:14:22)\n' +
      '    at http://localhost:57630/wallaby_sandbox7.html:9:292040\n' +
      '    at http://localhost:57630/wallaby_sandbox7.html:9:292054\n',
    "2025-02-14T01:16:08.691Z model [ERROR] Runtime error: ReferenceError: Cannot access 'PersonalInfoStore' before initialization\n" +
      '    at Module.PersonalInfoStore (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:5029:64)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:258554:85\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:258570:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:199395:76\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:199533:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:44726:69\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:44854:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:185618:69\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:185910:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:7423:75\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:7508:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:234187:74\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:234289:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:107937:84\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:107964:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:5036:78\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:5297:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:73228:78\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/____wallaby-bundle.js?1739495764399&wallabyFileId=bundle:73388:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/src/app/profile/personal-info/personal-info.component.spec.ts.wbp.js?1739495762511&wallabyFileId=190:3:82\n' +
      '    at window.__moduleBundler.modules.<computed> (http://localhost:57630/src/app/profile/personal-info/personal-info.component.spec.ts.wbp.js?1739495762511&wallabyFileId=190:165:3)\n' +
      '    at window.__moduleBundler.require (http://localhost:57630/____wallaby-webpack.js?1739495764186:28:18)\n' +
      '    at http://localhost:57630/____wallaby-webpack-bootstrapper.js?1739495764187:19:36\n' +
      '    at http://localhost:57630/__wallaby__/tracer.js:14:54248\n' +
      '    at o._doWhenReceiverIsReady (http://localhost:57630/__wallaby__/tracer.js:14:12016)\n' +
      '    at Object._startWhenReceiverIsReady (http://localhost:57630/__wallaby__/tracer.js:14:54214)\n' +
      '    at window.__moduleBundler.loadTests (http://localhost:57630/____wallaby-webpack-bootstrapper.js?1739495764187:14:22)\n' +
      '    at http://localhost:57630/wallaby_sandbox7.html:9:292040\n' +
      '    at http://localhost:57630/wallaby_sandbox7.html:9:292054\n',
@smcenlly
Copy link
Member

Can you please provide us a sample repo that fails in the same way so that we can reproduce the problem?

@smcenlly
Copy link
Member

Closing this issue as we haven't heard back. If you provide a sample, we'll reopen the issue.

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

No branches or pull requests

2 participants