0

i am currently working with mocha on tests written in typescript.

here is my mocha.opts file

--require ts-node/register
--watch-extensions ts
--reporter nyan
test/**/*.test.ts

in my package.json i have:

"scripts": {
  "test": "NODE_ENV=test mocha"
}

and then I run the npm test

However, this command creates a folder ts-node-b04239ff3a39df9137e32efd559f1a2935cb in my root directory.

The strangest thing is that when I run my tests using mocha cli, this folder is not created.

NODE_ENV=test ./node_modules/.bin/mocha

I would like to know what this file is and how to make it no longer appear ?

nkweb
  • 163
  • 1
  • 12

1 Answers1

1

The generated folder is the ts-node cache directory.

You can change the cache directory to different folder like /tmp/ using the --cacheDirectory option (or setting the TS_NODE_CACHE_DIRECTORY env)

https://github.com/TypeStrong/ts-node#cli-and-programmatic-options