rewire
rewire copied to clipboard
Rewire doesn't work with typescript
[Feature request] Support Tyescript.
Rewire cannot find files that have extension .ts or .tsx
as a workaround, you might be able to try compiling your ts to js in the interim @KaboomFox
@KaboomFox I had this problem a few weeks ago. I recommend taking a look at https://github.com/kulshekhar/ts-jest/issues/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.
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}