Repository: angular
Issue: TestBed: Error: Directive SomePipe has no selector, please add it!
Labels: type: bug/fix,area: testing,freq2: medium,regression,area: compiler,state: confirmed,P3,compiler: jit

<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅

Oh hi there! 😄

To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.

🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->


# 🐞 bug report

### Affected Package
<!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->
<!-- ✍️edit: --> The issue is caused by package @angular/core/testing


### Is this a regression?
Yes, this worked in 8.2.


### Description
When I have a Pipe in a library project that has a super class with a ngOnDestroy method, a TestBed that imports the library module fails with the error "Directive SomePipe has no selector, please add it!".

This doesn't happen when the super class does not have an ngOnDestroy method, and it doesn't happen if the Pipe is included directly in the TestBed, or if the Module is part of the default app instead of a library project.

```
export abstract class SomeBase  implements OnDestroy {
  /*
  * My real base class had a transform method, ect, but this seems to be
  *   all that's needed to trigger it, and it wouldn't trigger without it
  */
  ngOnDestroy() {
  }
}

@Pipe({
  name: 'some'
})
export class SomePipe extends SomeBase implements OnDestroy, PipeTransform {
  transform(value: unknown, ...args: unknown[]): unknown {
    return null;
  }

  //  Is this needed, or will Ivy use the base class's ngOnDestroy without it??
  //    it's not needed to trigger the error
  ngOnDestroy() {
    super.ngOnDestroy();
  }
}
```
```
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [SomeLibModule],
      declarations: [
        AppComponent
      ],
    }).compileComponents();
  }));
```
## 🔬 Minimal Reproduction
https://github.com/james-schwartzkopf/ng9-issues/tree/lib-pipe-issue

```
yarn
ng build some-lib
ng test
```
## 🔥 Exception or Error
<pre><code>
Error: Directive SomePipe has no selector, please add it!
    at verifySemanticsOfNgModuleDef (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:39047:1)
    at http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:39010:1
    at <Jasmine>
    at verifySemanticsOfNgModuleDef (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:39004:1)
    at Function.get (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:38956:1)
    at R3TestBedCompiler.applyProviderOverridesToModule (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:2087:44)
    at R3TestBedCompiler.compileTestModule (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:2386:1)
    at R3TestBedCompiler.finalize (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:1880:1)
    at TestBedRender3.get testModuleRef [as testModuleRef] (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:3253:1)
    at TestBedRender3.inject (http://localhost:9877/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:3110:1)
</code></pre>


## 🌍  Your Environment

**Angular Version:**
<pre><code>
<!-- run `ng version` and paste output below -->
<!-- ✍️-->
$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.1.0
Node: 12.16.1
OS: win32 x64

Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.901.0
@angular-devkit/build-angular      0.901.0
@angular-devkit/build-ng-packagr   0.901.0
@angular-devkit/build-optimizer    0.901.0
@angular-devkit/build-webpack      0.901.0
@angular-devkit/core               9.1.0
@angular-devkit/schematics         9.1.0
@ngtools/webpack                   9.1.0
@schematics/angular                9.1.0
@schematics/update                 0.901.0
ng-packagr                         9.1.0
rxjs                               6.5.5
typescript                         3.8.3
webpack                            4.42.0

</code></pre>

**Anything else relevant?**
<!-- ✍️Is this a browser specific issue? If so, please specify the browser and version. -->

<!-- ✍️Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->