bin/qunit.js
async function start () {
  let exitCode = 0
  const port = process.env.PORT || 3000
  console.log(chalk`{magenta creating app bundle}`)

  /**
   * Creating rollup bundle by bundling `test/qunit/index.js` file.
   */
  const bundle = await rollup.rollup({
    input: path.join(__dirname, '../test', 'qunit', 'index'),
    plugins: require('../rollupPlugins')
  })

  const { code } = await bundle.generate({
    file: path.join(__dirname, '../tmp', 'qunit.js'),
    format: 'umd',
    name: 'indicativeSpec'
  })

  const server = await sauceLabs.serve(qUnitTemplate(code), port)
  console.log(chalk`started app server on {green http://localhost:${port}}`)

  /**
   * Starting the HTTP server. If `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY`
   * env variables exists, we will run tests on sauce, otherwise
   * we will run them on user machine.
   */
  if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
    console.log(chalk`{yellow pass SAUCE_USERNAME & SAUCE_ACCESS_KEY to run tests on saucelabs}`)
    opn(`http://localhost:${port}`)
    return
  }

  const ngrok = require('ngrok')
  try {
    /**
     * Ngrok url
     */
    const publicUrl = await sauceLabs.getPublicUrl(port)
    console.log(chalk`started ngrok tunnel on {green ${publicUrl}}`)

    /**
     * Creating jobs with sauce labs
     */
    const jobs = await sauceLabs.createTestsJob(browsers, publicUrl)
    console.log(chalk`created {green ${jobs.length} jobs}`)

    /**
     * Monitoring jobs for results
     */
    console.log(chalk`{magenta monitoring jobs}`)
    const results = await sauceLabs.getJobsResult(jobs)

    /**
     * Got some results
     */
    results.forEach((result) => {
      console.log('')
      console.log(chalk`{bold ${result.platform.join(' ')}}`)
      console.log(chalk`  {green Passed ${result.result.passed}}`)
      console.log(chalk`  {red Failed ${result.result.failed}}`)
      console.log(`  Total ${result.result.total}`)
    })

    /**
     * Creating a new build to be annotated
     */
    const buildId = `build-${new Date().getTime()}`

    console.log('annotating jobs result')
    for (let result of results) {
      await sauceLabs.annotateJob(result.job_id, buildId, result.result.failed === 0)
    }
    console.log(chalk`{green done}`)
  } catch (error) {
    console.log(chalk`  {red Reaceived error}`)
    console.log(error)
    exitCode = 1
  }

  /**
   * Cleanup
   */
  ngrok.kill()
  server.close()
  process.exit(exitCode)
}
async function start () {
  let exitCode = 0
  const port = process.env.PORT || 3000
  console.log(chalk`{magenta creating app bundle}`)

  /**
   * Creating rollup bundle by bundling `test/qunit/index.js` file.
   */
  const bundle = await rollup.rollup({
    input: path.join(__dirname, '../test', 'qunit', 'index'),
    plugins: require('../rollupPlugins')
  })

  const { code } = await bundle.generate({
    file: path.join(__dirname, '../tmp', 'qunit.js'),
    format: 'umd',
    name: 'indicativeSpec'
  })

  const server = await sauceLabs.serve(qUnitTemplate(code), port)
  console.log(chalk`started app server on {green http://localhost:${port}}`)

  /**
   * Starting the HTTP server. If `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY`
   * env variables exists, we will run tests on sauce, otherwise
   * we will run them on user machine.
   */
  if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
    console.log(chalk`{yellow pass SAUCE_USERNAME & SAUCE_ACCESS_KEY to run tests on saucelabs}`)
    opn(`http://localhost:${port}`)
    return
  }

  const ngrok = require('ngrok')
  try {
    /**
     * Ngrok url
     */
    const publicUrl = await sauceLabs.getPublicUrl(port)
    console.log(chalk`started ngrok tunnel on {green ${publicUrl}}`)

    /**
     * Creating jobs with sauce labs
     */
    const jobs = await sauceLabs.createTestsJob(browsers, publicUrl)
    console.log(chalk`created {green ${jobs.length} jobs}`)

    /**
     * Monitoring jobs for results
     */
    console.log(chalk`{magenta monitoring jobs}`)
    const results = await sauceLabs.getJobsResult(jobs)

    /**
     * Got some results
     */
    results.forEach((result) => {
      console.log('')
      console.log(chalk`{bold ${result.platform.join(' ')}}`)
      console.log(chalk`  {green Passed ${result.result.passed}}`)
      console.log(chalk`  {red Failed ${result.result.failed}}`)
      console.log(`  Total ${result.result.total}`)
    })

    /**
     * Creating a new build to be annotated
     */
    const buildId = `build-${new Date().getTime()}`

    console.log('annotating jobs result')
    for (let result of results) {
      await sauceLabs.annotateJob(result.job_id, buildId, result.result.failed === 0)
    }
    console.log(chalk`{green done}`)
  } catch (error) {
    console.log(chalk`  {red Reaceived error}`)
    console.log(error)
    exitCode = 1
  }

  /**
   * Cleanup
   */
  ngrok.kill()
  server.close()
  process.exit(exitCode)
}
async function start ( ) { let exitCode = 0 const port = process . env . PORT || 3000 console . log ( chalk ` ` ) /**
   * Creating rollup bundle by bundling `test/qunit/index.js` file.
   */ const bundle = await rollup . rollup ( { input : path . join ( __dirname , '../test' , 'qunit' , 'index' ) , plugins : require ( '../rollupPlugins' ) } ) const { code } = await bundle . generate ( { file : path . join ( __dirname , '../tmp' , 'qunit.js' ) , format : 'umd' , name : 'indicativeSpec' } ) const server = await sauceLabs . serve ( qUnitTemplate ( code ) , port ) console . log ( chalk ` ${ port } ` ) /**
   * Starting the HTTP server. If `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY`
   * env variables exists, we will run tests on sauce, otherwise
   * we will run them on user machine.
   */ if ( ! process . env . SAUCE_USERNAME || ! process . env . SAUCE_ACCESS_KEY ) { console . log ( chalk ` ` ) opn ( ` ${ port } ` ) return } const ngrok = require ( 'ngrok' ) try { /**
     * Ngrok url
     */ const publicUrl = await sauceLabs . getPublicUrl ( port ) console . log ( chalk ` ${ publicUrl } ` ) /**
     * Creating jobs with sauce labs
     */ const jobs = await sauceLabs . createTestsJob ( browsers , publicUrl ) console . log ( chalk ` ${ jobs . length } ` ) /**
     * Monitoring jobs for results
     */ console . log ( chalk ` ` ) const results = await sauceLabs . getJobsResult ( jobs ) /**
     * Got some results
     */ results . forEach ( ( result ) => { console . log ( '' ) console . log ( chalk ` ${ result . platform . join ( ' ' ) } ` ) console . log ( chalk ` ${ result . result . passed } ` ) console . log ( chalk ` ${ result . result . failed } ` ) console . log ( ` ${ result . result . total } ` ) } ) /**
     * Creating a new build to be annotated
     */ const buildId = ` ${ new Date ( ) . getTime ( ) } ` console . log ( 'annotating jobs result' ) for ( let result of results ) { await sauceLabs . annotateJob ( result . job_id , buildId , result . result . failed === 0 ) } console . log ( chalk ` ` ) } catch ( error ) { console . log ( chalk ` ` ) console . log ( error ) exitCode = 1 } /**
   * Cleanup
   */ ngrok . kill ( ) server . close ( ) process . exit ( exitCode ) }
Start of the process

@method start
Start of the process