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


TypeScript chalk.red类代码示例

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


在下文中一共展示了red类的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: _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

示例3: 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

示例4: 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

示例5: assert

        this._activateSession(internalSession, (err: Error | null /*, newSession?: ClientSessionImpl*/) => {
            if (!err) {

                if (old_client !== this) {
                    // remove session from old client:
                    if (old_client) {
                        old_client._removeSession(internalSession);
                        assert(!_.contains(old_client._sessions, internalSession));
                    }

                    this._addSession(internalSession);
                    assert(internalSession._client === this);
                    assert(!internalSession._closed, "session should not vbe closed");
                    assert(_.contains(this._sessions, internalSession));
                }
                callback();

            } else {

                // istanbul ignore next
                if (doDebug) {
                    debugLog(chalk.red.bgWhite("reactivateSession has failed !"), err.message);
                }
                callback(err);
            }
        });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:26,代码来源:opcua_client_impl.ts

示例6: format

  public format(logLevel: LogLevel, message: string) {
    switch (logLevel) {
      case 'emergency':
        message = bgRed.underline(message);
        break;
      case 'alert':
        message = red.underline(message);
        break;
      case 'critical':
        message = bgYellow(message);
        break;
      case 'warning':
        message = yellow(message);
        break;
      case 'notice':
        message = magenta(message);
        break;
      case 'info':
        message = blue(message);
        break;
      case 'debug':
        message = gray(message);
        break;
    }

    return message;
  }
开发者ID:gitter-badger,项目名称:ubiquits,代码行数:27,代码来源:consoleLogger.service.ts

示例7: 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

示例8: 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

示例9: 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

示例10: 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


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