nx-extensions
nx-extensions copied to clipboard
Stencil: Test Suites: 0 of 3 total where executed
Describe the bug After setting up a fresh stencil project and running the test suite I always get the following output:
npx nx test core
[57:52.3] testing spec files
[57:52.4] jest args: --projectType=library --tsConfig=libs/core/tsconfig.spec.json
--configPath=libs/core/stencil.config.ts --outputPath=dist/libs/core --spec --max-workers=8
Test Suites: 0 of 3 total
Tests: 0 total
Snapshots: 0 total
Time: 0.265 s
Ran all test suites.
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project core
To Reproduce Steps to reproduce the behavior:
-
npx create-nx-workspace@latest
-
npm install @nxext/stencil --save-dev
-
npm i --save-dev @nrwl/jest @nrwl/storybook
-
npx nx g @nxext/stencil:lib core --buildable
-
npm install --save-dev @types/[email protected] [email protected] [email protected]
-
npx nx g @nxext/stencil:add-outputtarget core--outputType='angular'
-
npx nx test core
Expected behavior
I would expect all tests to run through. Right now all are successful because none are run. Maybe I am not using the correct version for @nrwl/jest
? since I do have to downgrade jest to 27.0.3
to make it runnable.
Any help would be appreciated. Thanks in advance 🙏
The problem here is that the default Version Nx ships with and what works with Stencil is different. I've to add (again) something to downgrade here
Maybe I can help you out here somehow, if you point me in the right direction? :)
@Ehrax, I'm a little afraid of what could be a solution here. We could downgrade automatically while installing deps, but this could harm other projects (eg, Angular, React, or something different) in the same Repo. There's a solution in the Stencil Issues to don't use the embedded Stencil functionality and use a standalone Jest config for that.
Soon there should be something from Stencil with Jest 28 (and hopefully easier to support newer versions) but not sure when it will be ready https://github.com/ionic-team/stencil/issues/3348
@DominikPieper Yeah while doing my research I also did find this exact issue in stencil. While I got that working, e2e tests where not possible.
I tried out now to downgrade too @nrwl/jest: 14.8.6
(quiet simple actually why I did not think about that before haha 😆 ).
This fixes the the stencil test suite for --e2e
&& --spec
right now in my project. The only other project which is sitting right now in our repo is an angular, but we are not running tests here right now.
But as you said it will probably harm later on other projects. Probably I guess the best way is here to wait for stencil to migrate to jest28 🤔
Yes, if we downgrade the @nrwl/jest package to v14 in a v15 environment, that'll definitively break stuff. The hard part here is, we can't easily fix what upstream isn't able to do ^^'