本文介绍了TypeError:在严格模式函数或用于调用它们的参数对象上,可能无法访问"caller","callee"和"arguments"属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下错误是什么意思,我该如何解决?
What does the following error mean, and how should I fix it?
$ npm test
> [email protected] test /Users/mishamoroshko/location-autosuggest
> mocha test --compilers js:babel/register
compareKeys()
should return -1
1) when first key is different
0 passing (301ms)
1 failing
1) compareKeys() should return -1 when first key is different:
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
at Context.<anonymous> (compare-keys/compare-keys.test.js:3:16)
以下是相关部分:
compare-keys/compare-keys.test.js
1. 'use strict';
2.
3. import { expect } from 'chai';
package.json
"scripts": {
"test": "mocha test --compilers js:babel/register"
}
.babelrc
{
"stage": 0
}
mocha.opts
我没有一个.
版本
- babel:5.5.1
- 摩卡咖啡:2.2.5
- 柴:3.0.0
推荐答案
从ES5开始,在严格模式下,您不能使用诸如 callee
之类的参数的某些属性.请参见被调用者页面上的MDN免责声明:
Since ES5, in strict mode, you cannot use some properties of arguments like callee
, etc. See for example the disclaimer on MDN on the callee page :
chai
可以使用以下属性之一.
chai
may use one of these properties.
这篇关于TypeError:在严格模式函数或用于调用它们的参数对象上,可能无法访问"caller","callee"和"arguments"属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!