Sha256: dbc403d57874e6d727960e64ca410fdf0932bdb3157ff8db81aee07e3f1518c7

Contents?: true

Size: 1.13 KB

Versions: 26

Compression:

Stored size: 1.13 KB

Contents

import { devUtils } from '~/core/utils/internal/devUtils'

export interface PrintStartMessageArgs {
  quiet?: boolean
  message?: string
  workerUrl?: string
  workerScope?: string
}

/**
 * Prints a worker activation message in the browser's console.
 */
export function printStartMessage(args: PrintStartMessageArgs = {}) {
  if (args.quiet) {
    return
  }

  const message = args.message || 'Mocking enabled.'

  // eslint-disable-next-line no-console
  console.groupCollapsed(
    `%c${devUtils.formatMessage(message)}`,
    'color:orangered;font-weight:bold;',
  )
  // eslint-disable-next-line no-console
  console.log(
    '%cDocumentation: %chttps://mswjs.io/docs',
    'font-weight:bold',
    'font-weight:normal',
  )
  // eslint-disable-next-line no-console
  console.log('Found an issue? https://github.com/mswjs/msw/issues')

  if (args.workerUrl) {
    // eslint-disable-next-line no-console
    console.log('Worker script URL:', args.workerUrl)
  }

  if (args.workerScope) {
    // eslint-disable-next-line no-console
    console.log('Worker scope:', args.workerScope)
  }

  // eslint-disable-next-line no-console
  console.groupEnd()
}

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.25 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.24 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.23 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.22 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.21 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.20 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.19 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.18 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.17 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.16 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.15 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.14 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.13 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.12 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.11 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.10 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.9 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.8 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts
clapton-0.0.7 lib/clapton/javascripts/node_modules/msw/src/browser/setupWorker/start/utils/printStartMessage.ts