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

Rewire doesn't work with typescript #185

Open
KaboomFox opened this issue Jul 17, 2020 · 4 comments
Open

Rewire doesn't work with typescript #185

KaboomFox opened this issue Jul 17, 2020 · 4 comments

Comments

@KaboomFox
Copy link

KaboomFox commented Jul 17, 2020

[Feature request] Support Tyescript.

Rewire cannot find files that have extension .ts or .tsx

@aubreyyan
Copy link

as a workaround, you might be able to try compiling your ts to js in the interim @KaboomFox

@TheJizel
Copy link

TheJizel commented Aug 3, 2020

@KaboomFox I had this problem a few weeks ago. I recommend taking a look at kulshekhar/ts-jest#1029. Using ts-jest with ts-node, you should be able to make it work.

I ultimately decided not to use rewire since there is an open issue about it messing up code coverage reporting, but perhaps that is not an issue for you.

@20k-ultra
Copy link

I have tried this module with success in my Typescript project. In fact, types even exist for this https://www.npmjs.com/package/@types/rewire.

There wasn't any special configuration required. I'm using mocha and my config is:

--exit
--require ts-node/register/transpile-only
--timeout 30000
--bail
test/*.{ts,js}

@dhensby
Copy link
Contributor

dhensby commented Sep 10, 2024

TS support added here: #204, released in v7

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

No branches or pull requests

5 participants