我一直在尝试使用 Jasmine 来测试我的代码,该代码运行良好,直到我需要测试使用自定义 Node 插件的代码。我需要以典型的方式添加插件,
var addon = require('../build/Release/addon.node');
在运行应用程序时工作得很好,但是 Jasmine 被它噎住了,吐了出来:
Error: The specified module could not be found.
有没有办法告诉 Jasmine 在哪里找到所需的模块?
最佳答案
使用__dirname +“/../path/to file”
- https://nodejs.org/docs/latest/api/globals.html#globals_dirname
关于javascript - Jasmine 并导入自定义 Node 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38894417/