Javascript Appium错误处理不支持';行不通

Javascript Appium错误处理不支持';行不通,javascript,typescript,jasmine,appium,webdriver-io,Javascript,Typescript,Jasmine,Appium,Webdriver Io,我是appium的新手,所以可能会做错什么 我对appium使用wdio和jasmine有问题 it('wtf', (done) => { client.init().element('someName').getText() // ^ here was a mistake .then(result => result, err => { // ^ this error h

我是appium的新手,所以可能会做错什么

我对appium使用wdio和jasmine有问题

it('wtf', (done) => {
  client.init().element('someName').getText()
//                       ^ here was a mistake
    .then(result => result, err => {
//                          ^ this error handling wasn't work  
  throw new Error(`Cannot get text of element: #someName\n${err}`);
  })
    .then(text => expect(text).toBe('correct'))
    .then(done)
});
appium服务器日志告诉我:

[HTTP] --> POST /wd/hub/session/63aa60d2-9638-4b1a-a226-cfbb2fcfce2c/element {"using":"css selector","value":"someName"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["css selector","someName","63aa60d2-9638-4b1a-a226-cfbb2fcfce2c"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[HTTP] <-- POST /wd/hub/session/63aa60d2-9638-4b1a-a226-cfbb2fcfce2c/element 500 4 ms - 152 
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"platformName":"android","app":"./app-dev-debug.apk","appPackage":"com.#####.dev.debug","appActivity":"com.#####.feature.start.StartActivity","avdReadyTimeout":1000,"udid":"LGK350RGNBS4TS","deviceName":"LG-K350","clearSystemFiles":true,"fullReset":true,"newCommandTimeout":120,"requestOrigins":{"url":"http://webdriver.io","version":"4.12.0","name":"webdriverio"}}}
“完成”不是应召承诺

配置的jasmine超时=300000

主要问题:为什么Jasmine没有收到抛出的异常?

找到了解决方案(虚拟修复):

使用功能:

testMobile = <T>(promise: Client<T>, done: () => void): Client<void> =>
promise.then(done, err => {
    expect(err).toBe('Ok');
    done();
});
testMobile = <T>(promise: Client<T>, done: () => void): Client<void> =>
promise.then(done, err => {
    expect(err).toBe('Ok');
    done();
});
it('wtf', done =>
  testMobile(client.init()
    .element('someName').getText()
    .then(result => result, err => {  
      throw new Error(`Cannot get text of element: #someName\n${err}`);
     })
     .then(text => expect(text).toBe('correct')),
  done)
};