Enzyme TypeError:不能使用'in'运算符在undefined中搜索'phoneUtils'

时间:2016-06-10 06:19:20

标签: javascript reactjs enzyme

这里我使用工具 Enzyme 来测试用ReactJs编写的Web应用程序。我有this工作,每当我尝试为我的应用程序运行测试时,我都会收到错误响应

  

/app/js/services/countries/lib/libphonenumber.js:1   (function(exports,require,module,__ filename,__ dirname){“use strict”;(function(){var aa = this; function l(a,b){var c = a.split(“。”),d = aa; c [0] in d ||!d.execScript || d.execScript(“var”+ c [0]); for(var e; c.length&&(e = c.shift() );){c.length || void 0 === b?d [e]?d = d [e]:d = d [e] = {}:d [e] = b;}}函数m( a,b){function c(){} c.prototype = b.prototype; ao = b.prototype; a.prototype = new c(); a.prototype.constructor = a; a。$ = function(a, c,f){for(var g = Array(arguments.length-2),h = 2; hc?Math.max(0,a.length + c):c; if(“string”== typeof a) return“string”== typeof b&& 1 == b.length?a.indexOf(b,c): - 1; for(; cb?1:a

然后

TypeError: Cannot use 'in' operator to search for 'phoneUtils' in undefined
at l (libphonenumber.js:1:126)
at libphonenumber.js:432:221
at Object.<anonymous> (libphonenumber.js:1:1)
at Module._compile (module.js:541:32)
at loader (/app/node_modules/babel-register/lib/node.js:158:5)
at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:168:7)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (CountryHandler.js:4:18)
at Module._compile (module.js:541:32)
at loader (/app/node_modules/babel-register/lib/node.js:158:5)
at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:168:7)
at Module.load (module.js:458:32)

在我的测试脚本中,我没有使用任何名为 phoneUtils 的参数,但找不到变量或值传递。由于我是酶工具的新手,而ReactJs实际上并不知道这里发生了什么。如果有人伸出援助之手会很棒。

0 个答案:

没有答案