devkit icon indicating copy to clipboard operation
devkit copied to clipboard

Test fail when using vitest, Angular 18 and @jscutlery/swc-angular v0.17.0

Open jahusa02 opened this issue 1 year ago • 4 comments

Hey!

I have a Stepper Component extending the CDKStepper. In it's Provider Array it has something like:

providers: [{provide: CDKStepper, useExisting: CustomStepper}]

Also We have a Custom Step Component having the same but CdkStep and CustomStep

In our tests we use a test Component that is using the Custom Stepper and Steps.

With version < 0.17.0, the CDKStepper gets its Constructor Arguments e.g. ChangeDetectorRef, but in version 0.17.0 it doesn't

The Error: TypeError: Cannot read properties of undefined (reading '_stateChanged') It's properly this line

Can't create a example repo for now. Just let me now if you need more infos

Thanks!

jahusa02 avatar Nov 29 '24 19:11 jahusa02

@jahusa02 Hi, did you update @swc/core to latest too? If it not help, need detailed reproduction for component and tests.

Also which version of angular you use?

pumano avatar Nov 30 '24 16:11 pumano

Angular 18 and yes, updated swc to latest version (1.9.X)

Hope I find time for it this weekend. It's the only test that fails in 4k Unit Tests. Kinda weird

jahusa02 avatar Nov 30 '24 16:11 jahusa02

https://github.com/jscutlery/devkit/issues/376

This issue is related I guess 🤔 weird that older versions seem to be affected but in another way

jahusa02 avatar Dec 01 '24 15:12 jahusa02

@jahusa02 OK try to dig to it soon, to check why that happens, because transpiled code works properly, but original code has problems.

pumano avatar Dec 01 '24 16:12 pumano