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

Unable to use expect types without jest types that leads to conflicts with mocha #9209

Closed
mgrybyk opened this issue Nov 19, 2019 · 5 comments

Comments

@mgrybyk
Copy link

mgrybyk commented Nov 19, 2019

🐛 Bug Report

I'd like to use expect with other test runner like mocha in TypeScript project.
However I'm not able to import expect types without jest while @types/jest is conflicting with @types/mocha.

To Reproduce

Steps to reproduce the behavior:

  1. install @types/mocha
  2. install @types/jest (looking for expect only types without jest)
  3. add both of them to tsconfig in order to use expect types with mocha runner

Expected behavior

ideally it should be possible to install @types/expect or import only expect types from @types/jest

envinfo

{
  "@types/jest": "^24.0.23",`
  "@types/mocha": "^5.2.7",
}
@cspotcode
Copy link
Contributor

Related: #8570

Although that issue was closed, it's not fixed; I'm still seeing the conflict between "expect" and "@types/mocha".

Here is a reproduction: https://repl.it/repls/LightgreyMustyAutoexec

@SimenB
Copy link
Member

SimenB commented Jan 14, 2020

@types/jest is not maintained in this repo, but it'll never work to have both @types/jest and @types/mocha as they conflict.

However, the case @cspotcode reports should ideally have worked, as expect comes with its own types. However, expect uses @jest/types which has the Global declaration, meaning it fails. We can probably split out the config types from @jest/types to avoid it. I've been meaning to have a separate jest-config module without all the dependencies anyways - can stick the types in there.

@cspotcode
Copy link
Contributor

@SimenB Can #8570 be re-opened, since it is not fixed and more accurately describes the problem than this issue?

I'm worried this issue will be closed for referring to @types/jest, and then the problem will be forgotten.

@SimenB
Copy link
Member

SimenB commented Jan 14, 2020

sure

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants