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

No updates until Jan 2025 #10487

Open
satanTime opened this issue Nov 16, 2024 · 17 comments
Open

No updates until Jan 2025 #10487

satanTime opened this issue Nov 16, 2024 · 17 comments

Comments

@satanTime
Copy link
Member

I guess you all noticed no active development of the library for several years.

It's going to change from January 2025.

Thanks to all who was patient and hasn't lost trust in ng-mocks.

@satanTime satanTime pinned this issue Nov 16, 2024
@JPtenBerge
Copy link

Not to add to any stress, but will Angular 19 get a relatively quick version support release before that time by any chance?

@jahusa02
Copy link

Hope so too...

@evtk
Copy link

evtk commented Nov 20, 2024

Thanks for the update @satanTime. I still use ng-mocks on daily basis as it abstracts so much of the unit test fuzz.

I came here after watching the updates for NG19 and noticing how there is getting more and more attention to implementing signals. The simple fact is that ng-mocks currently prevents me from starting to use the signal input api for instance instead of the regular Input decorator.

So really looking forward to updates on that part!

@JPtenBerge
Copy link

JPtenBerge commented Nov 20, 2024

@evtk ng-mocks hasn't prevented me from using signal inputs. ng-mocks simply doesn't provide any help in that area.

export class MyStepComponent {
    step = input.required<Step>();
beforeEach(() => {
    TestBed.configureTestingModule({
        providers: [MockProvider(...), MockProvider(...)],
        imports: [MyStepComponent],
    });

    fixture = TestBed.createComponent(MyStepComponent);
    sut = fixture.componentInstance;
    fixture.componentRef.setInput('step', currentStep);
});

I'm not using MockRender() though, is that what you're using?

@GipHub123
Copy link

@evtk
I can confirm that input signals work with the current version of ngMocks. However, as far as I know, certain features, such as ContentChildren and ViewChild, are not yet supported.
#8895

@satanTime
Copy link
Member Author

Hi all.

My main concern to release support of new versions is that my knowledge of changes in v18 and v19 is none, and I prefer to force developers to notice incompatibility with v19 and install ng-mocks with -f flag, so they understand what they do and what to expect, instead of saying that the lib works with v19.

Unfortunately, until Jan I don't have time at all due to private hassle.

@evtk
Copy link

evtk commented Nov 20, 2024

@evtk ng-mocks hasn't prevented me from using signal inputs. ng-mocks simply doesn't provide any help in that area.

export class MyStepComponent {
    step = input.required<Step>();
beforeEach(() => {
    TestBed.configureTestingModule({
        providers: [MockProvider(...), MockProvider(...)],
        imports: [MyStepComponent],
    });

    fixture = TestBed.createComponent(MyStepComponent);
    sut = fixture.componentInstance;
    fixture.componentRef.setInput('step', currentStep);
});

I'm not using MockRender() though, is that what you're using?

Yeah definitely went for being Pro and using MockRender everywhere in my tests :|

@JPtenBerge
Copy link

JPtenBerge commented Nov 21, 2024

@satanTime Understood, thanks for the response. And good luck on your private hassles.

@jahusa02
Copy link

Will you still be able to review PRs? If yes, I will try to at least fix the logic behind standalone :) In v19 the default flipped to true. If its possible to make this change backwards compatible I guess it wont be a new Major and so not affecting version < 19

@dmitry-stepanenko
Copy link

@jahusa02 if you will work on v19 support, you might be interested to look into my fork https://github.com/dmitry-stepanenko/ng-mocks/tree/ds/v19 . I managed to get standalone components to work well in v19 apps (it's a breaking change though). Package version with my changes can be installed directly from https://github.com/dmitry-stepanenko/ng-mocks/tree/v19-built

The only thing that I did not figure out is how to differentiate between v19 modules and old pre-compiled ones that come from 3rd party packages, because old ones should still keep "standalone: false" by default.

@GipHub123
Copy link

Hmmmh. If I'm not mistaken, 19 version fix seemed to be quite trivial 🤔

func.is-standalone.ts

return collectDeclarations(declaration)[type].standalone === true;
-->
return collectDeclarations(declaration)[type].standalone !== false;

@dmitry-stepanenko I didn’t find any version-related code either, so I assume that metadata is being used instead

In another words, change is not backward compatible.

@dmitry-stepanenko
Copy link

dmitry-stepanenko commented Nov 27, 2024

@GipHub123 there're a few other places where the flag should be changed in order for it to kinda work, this is done in the branch I shared above. But still if the mocked component imports an npm package that doesn't use standalone components inside, test will fail

@re-alam
Copy link

re-alam commented Nov 27, 2024

@GipHub123 @dmitry-stepanenko
I've found a simpler fix #10583 to make MockRender compatible with Angular 19. By setting the standalone property to false when generating wrapper component fixes the issue. I've also updated the isStandalone method to ensure backward compatibility. Please let me know if it works for you.

@GipHub123
Copy link

@re-alam I reviewed the code and it's seemed to be solid / it's backward compatible (I didn't test it) 👍 Version check seemed to be quite trivial / elegant 👍

@thiboot
Copy link

thiboot commented Dec 5, 2024

Good news for january !

@florestankorp
Copy link

@GipHub123 @dmitry-stepanenko I've found a simpler fix #10583 to make MockRender compatible with Angular 19. By 😎setting the standalone property to false when generating wrapper component fixes the issue. I've also updated the isStandalone method to ensure backward compatibility. Please let me know if it works for you.

Bro joined GitHub 2 weeks ago, forks 'ng-mocks', opens a PR with a fix for Angular v19. Absolute legend 😎

@Tallyb
Copy link

Tallyb commented Dec 15, 2024

vitest support would be great. Happy new year!

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

10 participants