smoke-testing.ts 410 字节
Newer Older
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
1
#!/usr/bin/env ts-node
2

3
import { Wechaty } from 'wechaty'
4 5 6 7

async function main() {
  const bot = Wechaty.instance()
  try {
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
8
    await bot.start()
9 10 11 12 13 14
    console.log(`Wechaty v${bot.version()} smoking test passed.`)
  } catch (e) {
    console.error(e)
    // Error!
    return 1
  } finally {
Huan (李卓桓)'s avatar
Huan (李卓桓) 已提交
15
    await bot.stop()
16 17 18 19 20 21 22 23 24 25
  }
  return 0
}

main()
.then(process.exit)
.catch(e => {
  console.error(e)
  process.exit(1)
})