Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/383.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript console.log变量时target.dispatchEvent上的TypeError_Javascript_Reactjs - Fatal编程技术网

Javascript console.log变量时target.dispatchEvent上的TypeError

Javascript console.log变量时target.dispatchEvent上的TypeError,javascript,reactjs,Javascript,Reactjs,我试图在我的react组件上运行测试,但当我console.log(nav) 错误: Chrome 44.0.2403 (Mac OS X 10.10.4) App has nav FAILED Error: the error "TypeError: target.dispatchEvent is not a function" was thrown, throw an Error :) 代码: 不太清楚如何调试,或者为什么会发生这种情况。当我移除console.log(nav)时,

我试图在我的
react
组件上运行测试,但当我
console.log(nav)

错误:

Chrome 44.0.2403 (Mac OS X 10.10.4) App has nav FAILED
    Error: the error "TypeError: target.dispatchEvent is not a function" was thrown, throw an Error :)
代码:


不太清楚如何调试,或者为什么会发生这种情况。当我移除
console.log(nav)
时,错误不会出现

而不是
console.log
尝试:

console.log(require('util').inspect(nav, { depth: null }));

我遇到了一个非常类似的问题,这就解决了它(不同的是,我使用的是
TestUtils.scryrenderdomcomponentswithtag
console.log(require('util').inspect(nav, { depth: null }));