Category: Unit Testing

0

Debug mocha using visual studio code

Add the following configuration in your launch.json { “name”: “Run mocha”, “type”: “node”, “request”: “launch”, “program”: “${workspaceRoot}/node_modules/mocha/bin/mocha”, “stopOnEntry”: false, “args”: [ “test/**/*.js”, “–inspect”, “–debug-brk”, “–no-timeouts” ], “cwd”: “${workspaceRoot}”, “runtimeExecutable”: null, “env”: { “NODE_ENV”: “testing”...

0

Cannot stub non-existent own property

The potential problem could be that sinon does not mock objects with dynamically-created methods through Object.prototype. To mitigate such problem, you can try the following : var sinon = require(‘sinon’); var sandbox = sinon.sandbox.create();...