是否可以在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 (将#修改为@)