我正在研究如何配置选项,并根据终端上选择的选项运行npm脚本
例如,我有一个package.json文件
{
"scripts": {
"tests:mac": "export ENV=dev& testcafe "chrome --start-fullscreen" automation_suite/",
"tests:windows": "set ENV=dev& testcafe "chrome --start-fullscreen" automation_suite/",
"tests": ??????
}
}
我应该在这里写什么"tests:"
我的要求是运行npm run tests
那么它应该在终端上提供选项,比如
OS:
windows <
mac
如果我选择了windows
,它应该执行tests:windows
如果我选择了mac
,它应该执行tests:mac
如何做到这一点?
尝试ntlhttps://github.com/ruyadorno/ntl可能是有用的。仍在努力寻找更好的选择