Category: Testing

mochajs 0

Debug mocha using visual studio code

Add the fol­low­ing con­fig­u­ra­tion in your launch.json { “name”: “Run mocha”, “type”: “node”, “request”: “launch”, “pro­gram”: “${workspaceRoot}/node_modules/mocha/bin/mocha”, “sto­pO­nEn­try”: false, “args”: [ “test/**/*.js”, “–inspect”, “–debug-brk”, “–no-timeouts” ], “cwd”: “${work­space­Root}”, “run­time­Ex­e­cutable”: null, “env”: { “NODE_ENV”: “testing”…

selenium 0

Automate chrome apps

Chrome apps writ­ten using web­view are dif­fer­ent than iFrames because web­view is a sep­a­rate process. With Sele­nium 2.20 it is pos­si­ble to auto­mate chrome apps writ­ten using web­view. dri­ver = webdriver.Chrome(desired_capabilities={‘chromeOptions’:{‘windowTypes’:[’webview’]}}) driver.get(‘chrome://apps’) wait_for_new_window_to_appear() driver.switch_to.window(driver.window_handles[1])…

sinonjs 0

Attempted to wrap undefined property as function

The poten­tial prob­lem could be that your meth­ods are dynamically-created meth­ods through Object.prototype. If that’s the case then, you can try the fol­low­ing : sinon.stub(FUT.prototype, “Foo”).returns(true); FUT — Func­tion Under Test

sinonjs 0

Cannot stub non-existent own property

The poten­tial prob­lem could be that sinon does not mock objects with dynamically-created meth­ods through Object.prototype. To mit­i­gate such prob­lem, you can try the fol­low­ing : var sinon = require(‘sinon’); var sand­box = sinon.sandbox.create();…