當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript jest-message-util.formatStackTrace函數代碼示例

本文整理匯總了TypeScript中jest-message-util.formatStackTrace函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript formatStackTrace函數的具體用法?TypeScript formatStackTrace怎麽用?TypeScript formatStackTrace使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了formatStackTrace函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: formatStackTrace

const formatStack = (thrown: Thrown | null) =>
  thrown === null || !thrown.isError
    ? ''
    : formatStackTrace(
        separateMessageFromStack(thrown.value.stack!).stack,
        {
          rootDir: process.cwd(),
          testMatch: [],
        },
        {
          noStackTrace: false,
        },
      );
開發者ID:facebook,項目名稱:jest,代碼行數:13,代碼來源:toThrowMatchers.ts

示例2: _logFormattedReferenceError

  private _logFormattedReferenceError(errorMessage: string) {
    const originalStack = new ReferenceError(errorMessage)
      .stack!.split('\n')
      // Remove this file from the stack (jest-message-utils will keep one line)
      .filter(line => line.indexOf(__filename) === -1)
      .join('\n');

    const {message, stack} = separateMessageFromStack(originalStack);

    console.error(
      `\n${message}\n` +
        formatStackTrace(stack, this._config, {noStackTrace: false}),
    );
  }
開發者ID:Volune,項目名稱:jest,代碼行數:14,代碼來源:index.ts

示例3: _checkFakeTimers

 private _checkFakeTimers() {
   if (this._global.setTimeout !== this._fakeTimerAPIs.setTimeout) {
     this._global.console.warn(
       `A function to advance timers was called but the timers API is not ` +
         `mocked with fake timers. Call \`jest.useFakeTimers()\` in this ` +
         `test or enable fake timers globally by setting ` +
         `\`"timers": "fake"\` in ` +
         `the configuration file. This warning is likely a result of a ` +
         `default configuration change in Jest 15.\n\n` +
         `Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15.html\n` +
         `Stack Trace:\n` +
         formatStackTrace(new Error().stack!, this._config, {
           noStackTrace: false,
         }),
     );
   }
 }
開發者ID:facebook,項目名稱:jest,代碼行數:17,代碼來源:jestFakeTimers.ts


注:本文中的jest-message-util.formatStackTrace函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。