0

我想覆盖一个函数“它”。我能做到?

old_it = it
it = (name, foo) ->
  console.log('111')
  old_it(name, foo)
  console.log('222')

当我运行此代码时,会向控制台输出一条消息“it = undefined”

4

1 回答 1

0

您需要更正文件 wdio.conf.js 中的beforeTestafterTest属性

...
    beforeTest: function (test, context) {
        console.log('start test ' + test.title)
    },
...

    afterTest: function(test, context, { error, result, duration, passed, retries }) {
        console.log('finish test ' + test.title)
    },
...
于 2021-12-28T12:18:01.110 回答