I want to re-require a module in TypeScript and Node multiple times for testing. According to this post that should work by using
const config = require('./foo');
delete require.cache[require.resolve('./foo')];
However, this does not work for me. Also, when I print out the object require.cache
, it is empty.