微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

是否可以在cypress中添加log4js?

如何解决是否可以在cypress中添加log4js?

我对于使用cypress还是很新的,我想使用log4js记录一些操作,但是当我在任何地方导入log4js时,都是这样

require("log4js")

我收到此错误

The following error originated from your test code,not from Cypress.

  > Cannot read property 'native' of undefined

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress Could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

Check your console for the stack trace or click this message to see where it originated from.
node_modules/fs-extra/lib/fs/index.js:107:1
  105 | 
  106 | // fs.realpath.native only available in Node v9.2+
> 107 | if (typeof fs.realpath.native === 'function') {
      | ^
  108 |   exports.realpath.native = u(fs.realpath.native)
  109 | }
  110 | 

我在Google中进行了搜索,但没有找到实现它的方法,我也想使用log4js,因为我想为每个测试创建一个日志文件,并且我了解cy.log不会创建日志文件

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。