0

in my node.js app I have a function that should rename directory path when the user do a http put request. Anyway this function uses shelljs and when I test it manually it works but when I try to test in mocha on my mocked filesystem then shelljs run all the shell commands on my real file system.

How can I fix it?

btw I use mock-fs for this and I am very new to unit tests.

thanks

Amit

4

1 回答 1

0

我觉得ShellJS一般兼容mock-fs(我在本地试过,好像可以)。这假设您正在从您运行的同一进程中运行 ShellJS 命令mock-fs(否则,请遵循 estus 的响应)。

于 2019-01-06T08:58:53.980 回答