Closed dhensby closed 1 year ago
When using rewire with typescript an error is thrown about assigning values to consts when trying to override top level variables.
This is because rewire is not intercepting and re-writing the compiled Typescript.
This change brings in support for .ts files by specifically overriding the .ts compile call and rewriting the compiled typescript from ts-node.
.ts
ts-node
The test provided is just a copy of the coffeescript test but for the TS file. Without the patch to moduleEnv.js the assign to const error is thrown.
moduleEnv.js
coverage: 98.063% (-0.7%) from 98.721% when pulling 2d7729f7c9e2ac03713d9644dcec1361b9cdb504 on dhensby:pulls/ts-support into 092e554955db2591d09b57d3b87a575ee0d510a9 on jhnns:master.
Awesome. Great work, thank you :) Shipped with v7.0.0 🚀
When using rewire with typescript an error is thrown about assigning values to consts when trying to override top level variables.
This is because rewire is not intercepting and re-writing the compiled Typescript.
This change brings in support for .ts files by specifically overriding the
.ts
compile call and rewriting the compiled typescript fromts-node
.The test provided is just a copy of the coffeescript test but for the TS file. Without the patch to
moduleEnv.js
the assign to const error is thrown.