Stencil version:
@stencil/[email protected]
I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
C:\ae\adaept.com\_components_\ae-icon5-component>npm test
> @adaept/[email protected] test C:\ae\adaept.com\_components_\ae-icon5-component
> stencil test --spec --e2e
[26:03.0] @stencil/core v1.9.0-14
[26:03.1] testing e2e and spec files
[26:03.1] build, aeicon5component, dev mode, started ...
[26:03.9] transpile started ...
[26:06.2] transpile finished in 2.28 s
[26:06.3] copy started ...
[26:06.6] generate styles started ...
[26:06.6] bundling components started ...
[26:07.0] generate styles finished in 448 ms
[26:09.0] bundling components finished in 2.36 s
[26:12.3] copy finished (2460 files) in 6.03 s
[26:12.4] build finished in 9.30 s
[26:12.6] jest args: --e2e --spec --max-workers=4
[ ERROR ] runJest: TypeError: runCLI is not a function
npm ERR! Test failed. See above for more details.
C:\ae\adaept.com\_components_\ae-icon5-component>
Expected behavior:
Tests work
Steps to reproduce:
Repo: https://github.com/adaept/ae-icon5-component
Related code:
// insert any relevant code here
Other information:
I am experiencing the same problem.
It's probably because you have installed jest-cli@25 instead of jest-cli@24?
It's probably because you have installed
jest-cli@25instead ofjest-cli@24?
"jest-cli": "24.9.0" is the entry in my package.json.
Hm ok it happens to me only when I upgrade jest, jest-cli and @types/jest to version 25. With 24.9 it seems to work fine.
Confirmed. Jest 24.9 OK, Jest 25 fail.
I will update the ticket title.
@adamdbradley @manucorporat
The ticket opened on jest reports this solution:
This is due to how stencil import runCLI here: https://github.com/ionic-team/stencil/blob/45821831683d0a468b1e38a3179b4c03c2acba7a/src/testing/jest/jest-runner.ts#L31. This was changed in #8874 (comment)
They can change their import from const { runCLI } = require('jest-cli'); to const { runCLI } = require('@jest/core');. That package started shipping in 24.3.0, so it should probably be a fallback if runCLI is not found from jest-cli package to support all releases of Jest 24. Can also do const { runCLI } = require('jest'). The programmatic API is pretty bad, tracked in #5048
We are running into this issue as well.
same issue for me
same issue for me
The related Jest issue.
If upgrade to Jest 25 then const { runCLI } = require('jest-cli'); has to be replaced with const { runCLI } = require('@jest/core');
@peterennis is right. It would be nice if somebody could take care of it. Is it planned?
Most helpful comment
@adamdbradley @manucorporat
The ticket opened on jest reports this solution:
This is due to how stencil import runCLI here: https://github.com/ionic-team/stencil/blob/45821831683d0a468b1e38a3179b4c03c2acba7a/src/testing/jest/jest-runner.ts#L31. This was changed in #8874 (comment)
They can change their import from const { runCLI } = require('jest-cli'); to const { runCLI } = require('@jest/core');. That package started shipping in 24.3.0, so it should probably be a fallback if runCLI is not found from jest-cli package to support all releases of Jest 24. Can also do const { runCLI } = require('jest'). The programmatic API is pretty bad, tracked in #5048