Is there any way I can debug my code (Node.js) and jasmine tests through VS Code? I have a spec in which I'm creating a spy, but my assertion that the spy should be called is returning false, even though when I invoke the function it calls within the spec manually it does run in to that code.
I've tried F5'ing the application to attach a debugger to the application which starts up an express server (that i've been using for testing until now) and then simply running jasmine
from the command prompt, but no breakpoints are hit.
As an example of what I'm doing in the spec, I'm setting up the spy as follows:
var response = {
tell: function(value) {
console.log("inside response.tell spy");
}
};
spyOn(response, "tell");
Invoking my function, passing in the response object and then adding my expectation:
expect(response.tell).toHaveBeenCalled();
But the expectation fails.
Thanks
您可以通过节点运行jasmine.js
文件,并将JASMINE_CONFIG_PATH
作为环境变量传递。
JASMINE_CONFIG_PATH="test/jasmine.json" node --debug-brk --no-lazy node_modules/jasmine/bin/jasmine.js
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.