updating to 13.0.3 breaks ng-mocks library
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
Yes
Description
After updating to angular 13.0.3 our test which rely on ng-mocks are failing. This can be traced to the removal of MockNgModuleResolver in d2cf130.
more information https://github.com/ike18t/ng-mocks/issues/1427
if this is not accidental, it is unclear why such a breaking change would happen on a patch version ?
see repro and reset HEAD~1 or revert to ng 13.0.2 for working version.
Please provide a link to a minimal reproduction of the bug
https://github.com/LPCmedia/sanitizer-test-issue.git
Please provide the exception or error you saw
FooComponent declaration has been passed into ng-mocks without Angular decorators. Therefore, it cannot be properly handled. Highly likely, jest.mock() has been used on its file, or ng-mocks is not in JIT mode. Otherwise, please create an issue on github: https://github.com/ike18t/ng-mocks/issues/new?title=False%20positive%20ng-mocks%20not%20in%20JIT. Thank you in advance for support.
at ../../../libs/ng-mocks/src/lib/common/error.missing-decorators.ts:4:9
at Object.<anonymous>.exports.default (../../../libs/ng-mocks/src/lib/common/core.reflect.body-catch.ts:12:27)
at ../../../libs/ng-mocks/src/lib/common/core.reflect.directive-resolve.ts:10:74
at decorateClass (../../../libs/ng-mocks/src/lib/mock-component/mock-component.ts:205:43)
at MockComponent (../../../libs/ng-mocks/src/lib/mock-component/mock-component.ts:240:3)
at src/app/app.component.spec.ts:9:49
at ../../node_modules/tslib/tslib.js:117:75
at new ZoneAwarePromise (../../node_modules/zone.js/bundles/zone-testing-bundle.umd.js:1347:33)
at __awaiter (../../node_modules/tslib/tslib.js:113:16)
at src/app/app.component.spec.ts:7:25
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (../../node_modules/zone.js/bundles/zone-testing-bundle.umd.js:407:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (../../node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3765:43)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (../../node_modules/zone.js/bundles/zone-testing-bundle.umd.js:406:56)
at Zone.Object.<anonymous>.Zone.run (../../node_modules/zone.js/bundles/zone-testing-bundle.umd.js:167:47)
at Object.wrappedFunc (../../node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4250:34)
Please provide the environment you discovered this bug in (run ng version
)
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1300.3
@angular-devkit/build-angular 13.0.3
@angular-devkit/core 13.0.3
@angular-devkit/schematics 13.0.3
@schematics/angular 13.0.3
rxjs 7.4.0
typescript 4.4.4
Anything else?
if this is not accidental, it is unclear why such a breaking change would happen on a patch version ?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:42
- Comments:8 (1 by maintainers)
Top Results From Across the Web
ng-mocks | Yarn - Package Manager
An Angular testing library for creating mock services, components, directives, pipes and modules in unit tests. It provides shallow rendering, precise stubs ...
Read more >ng-mocks/CHANGELOG.md - UNPKG
The CDN for ng-mocks. ... 144, * Revert "chore(deps): update dependency jest to v27" ... 160, * **core:** broken query selectors are properly...
Read more >How to update to the latest version of ng-mocks
Critical changes to consider during an updating process to the latest version of ng-mocks. ... The only breaking change is auto-spy .
Read more >https://raw.githubusercontent.com/ike18t/ng-mocks/...
[14.5.0](https://github.com/ike18t/ng-mocks/compare/v14.4.0...v14.5.0) ... BREAKING CHANGES * **MockBuilder:** MockBuilder with 2 params marks all chain ...
Read more >Tests failing after updating from 13.0.0 to latest 14.0.0 version ...
The owner of the library have just released 14.0.1 version which contains the fix. After you run npm i ngx-masonry@14.0.1 everything should ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JoostK @jelbourn I realize that depending on non public api’s is not ideal. I agree 110% with your response. The issue lies with the ng-mocks library that has not updated to Ivy compilation. As well to complicate things, they are supporting angular versions that are no longer LTS for some reason.
Yet as a “downstream” consumer of angular + ecosystem, it’s always surprising and a colossal pain to have this kind of change show up in a patch version. I would expect this to surface when upgrading a major version ( ex from 12 -> 13 ). From experience, the ecosystem will lag and fail on major’s. It seems that this cleanup was not done in time for 13.0.0 and squeezed into 13.0.3, casually and with no mention in changelogs.
From our perspective, other than the wasted time on trying to resolve the tests etc, it erodes confidence in our ui team which is the worst side effect. Given the response on the initial issue we are not the only ones. With this in mind I wonder:
And last but not least ( probably a separate discussion… ) :
But isn’t the solution for ng-mocks to drop support for ViewEngine?