Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/415.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 加载依赖JS文件的依赖项_Javascript_Node.js_Mocha.js - Fatal编程技术网

Javascript 加载依赖JS文件的依赖项

Javascript 加载依赖JS文件的依赖项,javascript,node.js,mocha.js,Javascript,Node.js,Mocha.js,我有一个可以在浏览器上运行的代码,我正在用mocha编写测试用例。 但我面临一个问题: parent.js function EntityAbstract() { this.$Ver = ''; } EntityAbstract.method('setVer', function($Ver) { this.$Ver = $Ver; }); child.js function Note($Id, $Text) { this.$Id = $Id; t

我有一个可以在浏览器上运行的代码,我正在用mocha编写测试用例。 但我面临一个问题:

parent.js

function EntityAbstract() {    
    this.$Ver = '';
}
EntityAbstract.method('setVer', function($Ver) {
        this.$Ver = $Ver;
});
child.js

function Note($Id, $Text) {
    this.$Id = $Id;
    this.$Text = $Text;
}

Note.inherits(EntityAbstract);
当我使用以下命令将上述代码包含在html文件中时,它可以正常工作:

<script type="text/javascript" src="app/scripts/Structure/parent.js"></script>
<script type="text/javascript" src="app/scripts/Structure/child.js"></script>
它抛出一个错误:

ReferenceError: EntityAbstract is not defined at Node.inherits(EntityAbstract)

注意:我无法在child.js中进行浏览器不支持的更改。

您在这里使用的是什么库?方法和继承方法不是本机JavaScriptI,我在function.prototype中添加了这些方法。你可以在这里看到,以便更好地理解。
ReferenceError: EntityAbstract is not defined at Node.inherits(EntityAbstract)