ng-mocks: Bug: Can't export pipe MockOfAsyncPipe from MockOfPipeModule as it was neither declared nor imported!
Description of the bug
Hi,
I’ve started to migrating a project to use standalone components. Not sure if this is bug or just me doing something wrong / is there something wrong with my environment?
I was able to create a simple example project.
When I run “ng test” -command, I got consistently following error:
Chrome 107.0.0.0 (Windows 10) NotStandaloneComponent should create FAILED
Error: Can't export pipe MockOfAsyncPipe from MockOfPipeModule as it was neither declared nor imported!
Can't export pipe MockOfCurrencyPipe from MockOfPipeModule as it was neither declared nor imported!
Can't export pipe MockOfDatePipe from MockOfPipeModule as it was neither declared nor imported!
Can't export pipe MockOfDecimalPipe from MockOfPipeModule as it was neither declared nor imported!
Can't export pipe MockOfPercentPipe from MockOfPipeModule as it was neither declared nor imported!
at verifySemanticsOfNgModuleDef (node_modules/@angular/core/fesm2020/core.mjs:24259:15)
at Function.get (node_modules/@angular/core/fesm2020/core.mjs:24183:21)
at getInjectorDef (node_modules/@angular/core/fesm2020/core.mjs:485:13)
at walkProviderTree (node_modules/@angular/core/fesm2020/core.mjs:6479:18)
at walkProviderTree (node_modules/@angular/core/fesm2020/core.mjs:6520:17)
at walkProviderTree (node_modules/@angular/core/fesm2020/core.mjs:6520:17)
at fn (node_modules/@angular/core/fesm2020/core.mjs:6535:25)
at forEach (node_modules/@angular/core/fesm2020/core.mjs:4217:76)
at Array.forEach (<anonymous>)
at deepForEach (node_modules/@angular/core/fesm2020/core.mjs:4217:11)
Chrome 107.0.0.0 (Windows 10): Executed 6 of 6 (1 FAILED) (0.341 secs / 0.307 secs)
TOTAL: 1 FAILED, 5 SUCCESS
$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 14.2.10
Node: 16.17.0
Package Manager: npm 8.15.0
OS: win32 x64
Angular: 14.2.11
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1402.10
@angular-devkit/build-angular 14.2.10
@angular-devkit/core 14.2.10
@angular-devkit/schematics 14.2.10
@angular/cli 14.2.10
@schematics/angular 14.2.10
rxjs 7.5.7
typescript 4.7.4
An example of the bug
Link: example_v2.zip
Weird thing is that when I run this failing test cases with WebStorm -> It passes consistently. I tested this also with latest v15 and got similar results.
Expected vs actual behavior
Test passes
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (13 by maintainers)
Commits related to this issue
- fix(core): correct caching of touched declarations #4344 — committed to satanTime/ng-mocks by satanTime 2 years ago
- fix(core): correct caching of touched declarations #4344 — committed to satanTime/ng-mocks by satanTime 2 years ago
- Merge pull request #4350 from satanTime/issues/4344 fix(core): correct caching of touched declarations #4344 — committed to help-me-mom/ng-mocks by satanTime 2 years ago
- feat(core): hidden usage of MockBuilder in TestBed if kept and mock modules are used together #4344 — committed to satanTime/ng-mocks by satanTime 2 years ago
- feat(core): hidden usage of MockBuilder in TestBed if kept and mock modules are used together #4344 — committed to satanTime/ng-mocks by satanTime 2 years ago
- feat(core): hidden usage of MockBuilder in TestBed if kept and mock modules are used together #4344 — committed to satanTime/ng-mocks by satanTime 2 years ago
- Merge pull request #4418 from satanTime/issues/4344 feat(core): hidden usage of MockBuilder in TestBed if kept and mock modules are used together #4344 — committed to help-me-mom/ng-mocks by satanTime 2 years ago
I found the problem, that’s because of cached declarations.
Is there a reason why you don’t use
MockBuilder?The min test to reproduce the issue:
I see, that’s good 😃
if you have a chance to setup the failing env and test the updated build, it’ll be really great.
Otherwise, stay in touch and have a nice weekend!
v14.4.0 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems.