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

Shallow testing for standalone components? #237

Closed
floisloading opened this issue Jan 9, 2023 · 1 comment · Fixed by #239
Closed

Shallow testing for standalone components? #237

floisloading opened this issue Jan 9, 2023 · 1 comment · Fixed by #239

Comments

@floisloading
Copy link

Is this possible? I couldn't find any documentation. Using any parameter for Module in new Shallow(ColorComponent, SharedModule); results in an error:

Error: Unexpected "ColorComponent" found in the "declarations" array of the "ShallowTestModule" NgModule, "ColorComponent" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?
	    at verifySemanticsOfNgModuleDef (node_modules/@angular/core/fesm2020/core.mjs:24319:15)
	    at forEach (node_modules/@angular/core/fesm2020/core.mjs:24292:9)
	    at Array.forEach (<anonymous>)
	    at verifySemanticsOfNgModuleDef (node_modules/@angular/core/fesm2020/core.mjs:24290:60)
	    at Function.get (node_modules/@angular/core/fesm2020/core.mjs:24243:21)
	    at TestBedCompiler.applyProviderOverridesInScope (node_modules/@angular/core/fesm2020/testing.mjs:25520:33)
	    at TestBedCompiler.compileTestModule (node_modules/@angular/core/fesm2020/testing.mjs:25810:14)
	    at TestBedCompiler.finalize (node_modules/@angular/core/fesm2020/testing.mjs:25362:14)

I'm using shallow-render 14.2.0 and Angular 14.2.1

@freddysilber
Copy link
Contributor

I'm running into the same issue running Angular 14.2.10. In my case, I have a Pipe that's marked as standalone breaking my tests.

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

Successfully merging a pull request may close this issue.

2 participants