在 Node.js 中检查带有除沟器的方法链

Inspect a Method Chain with a Degugger in Node.js

本文关键字:方法 js Node 检查      更新时间:2023-09-26

我正在尝试调试这种东西:

browser
  .chain
  .session()
  .open('/')
  .type('q', 'Hello World')
  .click('btnG')
  .waitForTextPresent('Hello World')
  .getTitle(function(title){
    assert.ok(~title.indexOf('hello world'), 'Title did not include the query: ' + title);
  })
  .click('link=Advanced search')
  .waitForPageToLoad(2000)
  .assertText('css=#gen-query', 'Hello World')
  .assertAttribute('as_q@value', 'Hello World')
  .end(function(err){
    browser.testComplete(function(){
      console.log('done');
      if (err) throw err;
    });
  });

我已经设法使用直接node debug app.js或使用node-inspectorchrome来连接调试器。但是,当我尝试在 .click('btnG') 处创建一个断点时,它不起作用,它只会在链的末端创建一个断点。 node.js似乎将整个链条视为一个单一的陈述。

如何逐步调试这种链接?如何在此注入 REPL?谢谢!

尝试下划线中的 tap 方法.js

  • http://underscorejs.org/#tap