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
You can run the jasmine.js file via node and pass JASMINE_CONFIG_PATH as an environment variable.
JASMINE_CONFIG_PATH="test/jasmine.json" node --debug-brk --no-lazy node_modules/jasmine/bin/jasmine.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With