Exporting classes with node.js

后端 未结 4 918
清歌不尽
清歌不尽 2020-12-13 13:25

I have the following test code that is being ran by jasmine-node in a file called bob_test.spec.js

require(\'./bob\');

describe(\"Bob\", functi         


        
4条回答
  •  旧时难觅i
    2020-12-13 13:56

    require returns an object, you should store it somewhere

    var Bob = require('./bob');
    

    and then use this object

    var bobInstance = new Bob();
    

提交回复
热议问题