I've been trying to use Jasmine to test my code which has worked fine until I needed to test code that used a custom Node addon. I'm requiring the addon in the typical way,
我一直在尝试使用Jasmine来测试我的代码,该代码工作正常,直到我需要测试使用自定义Node插件的代码。我以典型的方式要求插件,
var addon = require('../build/Release/addon.node');
which works totally fine while running the application, but Jasmine chokes on it, spitting out:
在运行应用程序时工作完全正常,但Jasmine呛到它,随地吐出:
Error: The specified module could not be found.
Is there a way to tell Jasmine where to find the required modules?
有没有办法告诉Jasmine在哪里找到所需的模块?
1 个解决方案
#1
1
Use __dirname + "/../path/to file"
- https://nodejs.org/docs/latest/api/globals.html#globals_dirname
使用__dirname +“/../path / to file” - https://nodejs.org/docs/latest/api/globals.html#globals_dirname
#1
1
Use __dirname + "/../path/to file"
- https://nodejs.org/docs/latest/api/globals.html#globals_dirname
使用__dirname +“/../path / to file” - https://nodejs.org/docs/latest/api/globals.html#globals_dirname