当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript red.bold方法代码示例

本文整理汇总了TypeScript中chalk.red.bold方法的典型用法代码示例。如果您正苦于以下问题:TypeScript red.bold方法的具体用法?TypeScript red.bold怎么用?TypeScript red.bold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chalk.red的用法示例。


在下文中一共展示了red.bold方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: async

 process.on("SIGINT", async () => {
     // only work on linux apparently
     console.error(chalk.red.bold(" Received server interruption from user "));
     console.error(chalk.red.bold(" shutting down ..."));
     await server.shutdown(1000);
     console.error(chalk.red.bold(" shot down ..."));
     process.exit(1);
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:simple_secure_server.ts

示例2: log

export function log( type: 'title' | 'success' | 'error' | 'step' | 'substep' | 'default' = 'default', message: string = '' ): void {

	switch( type ) {

		case 'title':
			console.log( chalk.white.bold.underline( message ) );
			break;

		case 'success':
			console.log( chalk.green.bold( message ) );
			break;

		case 'error':
			console.log( chalk.red.bold( message ) );
			break;

		case 'step':
			console.log( chalk.white.bold( `  ${  message }` ) );
			break;

		case 'substep':
			console.log( chalk.gray( `    ${ arrowSymbol } ${  message }` ) );
			break;

		default:
			console.log( message );

	}

}
开发者ID:dominique-mueller,项目名称:automatic-release,代码行数:30,代码来源:log.ts

示例3: async

    const onResult = async (test: Test, testResult: TestResult) => {
      if (watcher.isInterrupted()) {
        return Promise.resolve();
      }

      if (testResult.testResults.length === 0) {
        const message = 'Your test suite must contain at least one test.';

        return onFailure(test, {
          message,
          stack: new Error(message).stack,
        });
      }

      // Throws when the context is leaked after executing a test.
      if (testResult.leaks) {
        const message =
          chalk.red.bold('EXPERIMENTAL FEATURE!\n') +
          'Your test suite is leaking memory. Please ensure all references are cleaned.\n' +
          '\n' +
          'There is a number of things that can leak memory:\n' +
          '  - Async operations that have not finished (e.g. fs.readFile).\n' +
          '  - Timers not properly mocked (e.g. setInterval, setTimeout).\n' +
          '  - Keeping references to the global scope.';

        return onFailure(test, {
          message,
          stack: new Error(message).stack,
        });
      }

      addResult(aggregatedResults, testResult);
      await this._dispatcher.onTestResult(test, testResult, aggregatedResults);
      return this._bailIfNeeded(contexts, aggregatedResults, watcher);
    };
开发者ID:facebook,项目名称:jest,代码行数:35,代码来源:TestScheduler.ts

示例4: _validateSequenceNumber

    private _validateSequenceNumber(sequenceNumber: number) {

        // checking that sequenceNumber is increasing
        assert(_.isFinite(this._previousSequenceNumber));
        assert(_.isFinite(sequenceNumber) && sequenceNumber >= 0);

        let expectedSequenceNumber;
        if (this._previousSequenceNumber !== -1) {

            expectedSequenceNumber = this._previousSequenceNumber + 1;

            if (expectedSequenceNumber !== sequenceNumber) {
                const errMessage = "Invalid Sequence Number found ( expected " + expectedSequenceNumber + ", got " + sequenceNumber + ")";

                /* istanbul ignore next */
                debugLog(chalk.red.bold(errMessage));
                /**
                 * notify the observers that a message with an invalid sequence number has been received.
                 * @event invalid_sequence_number
                 * @param  expected sequence Number
                 * @param  actual sequence Number
                 */
                this.emit("invalid_sequence_number", expectedSequenceNumber, sequenceNumber);
            }
            // todo : handle the case where sequenceNumber wraps back to < 1024
        }
        /* istanbul ignore next */
        if (doDebug) {
            debugLog(chalk.yellow.bold(" Sequence Number = "), sequenceNumber);
        }
        this._previousSequenceNumber = sequenceNumber;
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:32,代码来源:message_builder.ts

示例5: Error

const validateSnapshotVersion = (snapshotContents: string) => {
  const versionTest = SNAPSHOT_VERSION_REGEXP.exec(snapshotContents);
  const version = versionTest && versionTest[1];

  if (!version) {
    return new Error(
      chalk.red(
        `${chalk.bold('Outdated snapshot')}: No snapshot header found. ` +
          `Jest 19 introduced versioned snapshots to ensure all developers ` +
          `on a project are using the same version of Jest. ` +
          `Please update all snapshots during this upgrade of Jest.\n\n`,
      ) + SNAPSHOT_VERSION_WARNING,
    );
  }

  if (version < SNAPSHOT_VERSION) {
    return new Error(
      chalk.red(
        `${chalk.red.bold('Outdated snapshot')}: The version of the snapshot ` +
          `file associated with this test is outdated. The snapshot file ` +
          `version ensures that all developers on a project are using ` +
          `the same version of Jest. ` +
          `Please update all snapshots during this upgrade of Jest.\n\n`,
      ) +
        `Expected: v${SNAPSHOT_VERSION}\n` +
        `Received: v${version}\n\n` +
        SNAPSHOT_VERSION_WARNING,
    );
  }

  if (version > SNAPSHOT_VERSION) {
    return new Error(
      chalk.red(
        `${chalk.red.bold('Outdated Jest version')}: The version of this ` +
          `snapshot file indicates that this project is meant to be used ` +
          `with a newer version of Jest. The snapshot file version ensures ` +
          `that all developers on a project are using the same version of ` +
          `Jest. Please update your version of Jest and re-run the tests.\n\n`,
      ) +
        `Expected: v${SNAPSHOT_VERSION}\n` +
        `Received: v${version}`,
    );
  }

  return null;
};
开发者ID:facebook,项目名称:jest,代码行数:46,代码来源:utils.ts

示例6: async

const ensureMasterBranch = async () => {
  const currentBranch = await execa.stdout('git', ['symbolic-ref', '--short', 'HEAD']);
  const status = await execa.stdout('git', ['status', '--porcelain']);

  if (currentBranch !== 'master' && status !== '') {
    console.error(chalk.red.bold('You need to be on clean master branch to release @grafana/ui'));
    process.exit(1);
  }
};
开发者ID:johntdyer,项目名称:grafana,代码行数:9,代码来源:grafanaui.release.ts

示例7: reportError

function reportError(error: CommandError) {
	let exitCode = 1;
	if (error.exitCode !== undefined) {
		exitCode = error.exitCode;
	}

	console.error(chalk.red.bold(error.message));
	process.exit(exitCode);
}
开发者ID:dojo,项目名称:cli,代码行数:9,代码来源:registerCommands.ts

示例8: async

process.on("SIGINT", async () => {

    console.log(" user interruption ...");

    user_interruption_count += 1;
    if (user_interruption_count >= 3) {
        process.exit(1);
    }
    if (the_subscription) {
        console.log(chalk.red.bold(" Received client interruption from user "));
        console.log(chalk.red.bold(" shutting down ..."));
        const subscription = the_subscription;
        the_subscription = null;;
        await subscription.terminate();
        await the_session.close();
        await client.disconnect();
        process.exit(0);
    }
});
开发者ID:node-opcua,项目名称:node-opcua,代码行数:19,代码来源:simple_client.ts

示例9: setTimeout

 setTimeout(() => {
   console.error(
     chalk.red.bold(
       'Jest did not exit one second after the test run has completed.\n\n',
     ) +
       chalk.red(
         'This usually means that there are asynchronous operations that ' +
           "weren't stopped in your tests. Consider running Jest with " +
           '`--detectOpenHandles` to troubleshoot this issue.',
       ),
   );
 }, 1000).unref();
开发者ID:Volune,项目名称:jest,代码行数:12,代码来源:index.ts

示例10: _read_headers

    protected _read_headers(binaryStream: BinaryStream): boolean {

        super._read_headers(binaryStream);

        assert(binaryStream.length === 12);

        const msgType = this.messageHeader.msgType;

        if (msgType === "HEL" || msgType === "ACK") {

            this.securityPolicy = SecurityPolicy.None;
        } else if (msgType === "ERR") {

            // extract Error StatusCode and additional message
            binaryStream.length = 8;
            const errorCode = decodeStatusCode(binaryStream);
            const message = decodeString(binaryStream);

            /* istanbul ignore next */
            if (doDebug) {
                debugLog(chalk.red.bold(" ERROR RECEIVED FROM SENDER"), chalk.cyan(errorCode.toString()), message);
                debugLog(hexDump(binaryStream.buffer));
            }
            return true;

        } else {

            this.securityHeader = chooseSecurityHeader(msgType);
            this.securityHeader.decode(binaryStream);

            if (msgType === "OPN") {
                const asymmetricAlgorithmSecurityHeader = this.securityHeader as AsymmetricAlgorithmSecurityHeader;
                this.securityPolicy = fromURI(asymmetricAlgorithmSecurityHeader.securityPolicyUri);
                this.cryptoFactory = getCryptoFactory(this.securityPolicy);
            }

            if (!this._decrypt(binaryStream)) {
                return false;
            }

            this.sequenceHeader = new SequenceHeader();
            this.sequenceHeader.decode(binaryStream);

            /* istanbul ignore next */
            if (doDebug) {
                debugLog(" Sequence Header", this.sequenceHeader);
            }

            this._validateSequenceNumber(this.sequenceHeader.sequenceNumber);
        }
        return true;
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:52,代码来源:message_builder.ts


注:本文中的chalk.red.bold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。