[英]Preserve symbolic link in mocha js
In node, if you want to preserve symbolic link when you run a script only add the flag: node --preserve-symlinks index.js
I think to use the same thing using mocha js for a test, but this not work, in docs, I can't found how to use this flag or alternative flag for testing purposes and keep the symbolic links to another repository in node_modules.在节点中,如果要在运行脚本时保留符号链接,只需添加标志: node --preserve-symlinks index.js
我认为使用 mocha js 进行测试时使用相同的东西,但这在文档中不起作用,我找不到如何使用此标志或替代标志进行测试,并将符号链接保留到 node_modules 中的另一个存储库。
I try this to, without success:我尝试这样做,但没有成功:
"test": "set NODE_OPTIONS=--preserve-symlinks & mocha --recursive --exit",
"test": "mocha --preserve-symlinks --recursive --exit",
What can I do?我能做些什么?
I had the same problem, this was my original script:我有同样的问题,这是我原来的脚本:
"test:unit": "mocha --opts mocha.opts --timeout 30000 \"test/unit/**/*.js\"",
changed it to this:将其更改为:
"test:unit": "node --preserve-symlinks ./node_modules/.bin/mocha --opts mocha.opts --timeout 30000 \"test/unit/**/*.js\""
And it works: :)它有效::)
Without more explanation of your project structure I cannot say why --preserve-symlink
is not working for you, but the following command will run Mocha while preserving the symlinks:如果不对您的项目结构进行更多解释,我无法说明为什么--preserve-symlink
对您不起作用,但是以下命令将在运行 Mocha 的同时保留符号链接:
mocha --preserve-symlinks --exit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.