Replies: 1 comment 8 replies
-
|
My knowledge of this package is limited, and this is beyond the scope of Spectator. We encourage you to create a PR and explain any changes you would like to make. Moving to discussions for now. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm submitting a...
Problem description
I wrote some tests using
createHostFactorythat worked fine when I built my code usingkarma-webpack, but I'm trying to switch tokarma-typescriptand I can't get them working again.Under
karma-webpack, the AngularCompilerPlugin did AOT (Ivy) template compilation, but when I switched tokarma-typescript, I had to use the JIT compiler. For non-Spectator tests, I would changeto
This change allowed all the tests to run without problems. For Spectator tests, I didn't need to include a call to
configureTestingModulebefore, but without one I got errors duringcreateHostabout un-compiled templates. So, I changedto
This fixed the error about uncompiled templates, but now during the
createHostcall, it fails with an error that it's unable to resolveHelloComponent. The error message includes the entire (compiled) text ofHelloComponentinline -- from the linked repro:It looks like the template engine is trying to use
HelloComponentas an injection token (?) but failing to look it up, even though it's been added todeclarations. I've also tried declaring it usingcreateHostFactory, by removingdeclareComponent: false, and taking it out of thedeclarationspassed toconfigureTestingModule, but the error is the same.I tried looking through the docs, both here and at
karma-typescript, but I'm running out of ideas. As I said, it worked fine when the tests were bundled with Webpack/AngularCompilerPlugin. I don't know if I'm using Spectator wrong, using karma-typescript wrong, or if there's a bug in one or the other of the libraries that prevents this from working.Minimal reproduction of the problem with instructions
Repro here, based on the karma-typescript Angular starter project.
Environment
Beta Was this translation helpful? Give feedback.
All reactions