• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vuepress / vuepress-next / 3860787019

pending completion
3860787019

Pull #1230

github

GitHub
Merge a55297b33 into b4e313bb7
Pull Request #1230: feat: add helper package

325 of 478 branches covered (67.99%)

Branch coverage included in aggregate %.

8 of 8 new or added lines in 2 files covered. (100.0%)

685 of 1011 relevant lines covered (67.75%)

42.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

6.67
/packages/utils/src/withSpinner.ts
1
import process from 'node:process'
2
import ora, { type Ora } from 'ora'
3
import { formatMs } from './formatMs.js'
4

5
export const withSpinner =
6
  (msg: string) =>
41✔
7
  async <T>(target: (spinner?: Ora) => Promise<T>): Promise<T> => {
×
8
    if (process.env.DEBUG) {
×
9
      return target()
×
10
    }
11

12
    const start = Date.now()
×
13
    const spinner = ora()
×
14
    try {
×
15
      spinner.start(msg)
×
16
      const result = await target(spinner)
×
17
      spinner.succeed(`${msg} - done in ${formatMs(Date.now() - start)}`)
×
18
      return result
×
19
    } catch (e) {
20
      spinner.fail(`${msg} - failed in ${formatMs(Date.now() - start)}`)
×
21
      throw e
×
22
    }
23
  }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc