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

[ ERROR ] runJest: TypeError: runCLI is not a function - with Jest 25 #2168

Closed
peterennis opened this issue Jan 28, 2020 · 11 comments · Fixed by #2387
Closed

[ ERROR ] runJest: TypeError: runCLI is not a function - with Jest 25 #2168

peterennis opened this issue Jan 28, 2020 · 11 comments · Fixed by #2387
Labels

Comments

@peterennis
Copy link
Contributor

Stencil version:

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:

@ionitron-bot ionitron-bot bot added the triage label Jan 28, 2020
@starikcetin
Copy link

I am experiencing the same problem.

@simonhaenisch
Copy link
Contributor

It's probably because you have installed jest-cli@25 instead of jest-cli@24?

@starikcetin
Copy link

It's probably because you have installed jest-cli@25 instead of jest-cli@24?

"jest-cli": "24.9.0" is the entry in my package.json.

@simonhaenisch
Copy link
Contributor

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.

@peterennis
Copy link
Contributor Author

Confirmed. Jest 24.9 OK, Jest 25 fail.
I will update the ticket title.

@peterennis peterennis changed the title [ ERROR ] runJest: TypeError: runCLI is not a function [ ERROR ] runJest: TypeError: runCLI is not a function - with Jest 25 Feb 3, 2020
@peterennis
Copy link
Contributor Author

@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

@driskull
Copy link

We are running into this issue as well.

@mmakrzem
Copy link

mmakrzem commented Mar 2, 2020

same issue for me

1 similar comment
@Jagget
Copy link
Contributor

Jagget commented Mar 10, 2020

same issue for me

@peterpeterparker
Copy link
Contributor

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');

@elpupi
Copy link

elpupi commented May 13, 2020

@peterennis is right. It would be nice if somebody could take care of it. Is it planned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants