javascriptunit-testingyeoman

Change yeoman-test.run() default temporal directory


I use Mocha to unit test my Yeoman generator. It creates a lot of files so I thought it would be nice to use tmpfs (RAM file system) to make i/o much faster.

I found that yeoman-test.run() uses the /tmp directory on Linux to temporarily generate a scaffolding in a sub directory, named with the random ID for the app. I can not mount /tmp as a tmpfs, because too many applications use that to store temporary files and I do not have enough RAM.

So I mounted a tmpfs as /var/tmpfs.

Question: How can I change yeoman-test.run() default temporary directory path?


Solution

  • The inDir(dirPath, optionalCallback) method of yeoman-test.run() can do that.