本文整理汇总了TypeScript中jest-util.clearLine函数的典型用法代码示例。如果您正苦于以下问题:TypeScript clearLine函数的具体用法?TypeScript clearLine怎么用?TypeScript clearLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clearLine函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: run
export async function run(maybeArgv?: Array<string>, project?: Config.Path) {
try {
const argv: Config.Argv = buildArgv(maybeArgv);
if (argv.init) {
await init();
return;
}
const projects = getProjectListFromCLIArgs(argv, project);
const {results, globalConfig} = await runCLI(argv, projects);
readResultsAndExit(results, globalConfig);
} catch (error) {
clearLine(process.stderr);
clearLine(process.stdout);
if (error.stack) {
console.error(chalk.red(error.stack));
} else {
console.error(chalk.red(error));
}
exit(1);
throw error;
}
}
开发者ID:facebook,项目名称:jest,代码行数:26,代码来源:index.ts
示例2: onRunComplete
onRunComplete() {
this.forceFlushBufferedOutput();
this._status.runFinished();
process.stdout.write = this._out;
process.stderr.write = this._err;
clearLine(process.stderr);
}
开发者ID:Volune,项目名称:jest,代码行数:7,代码来源:default_reporter.ts
示例3: clearLine
const showTestPathPatternError = (testPathPattern: string) => {
clearLine(process.stdout);
console.log(
chalk.red(
` Invalid testPattern ${testPathPattern} supplied. ` +
`Running all tests instead.`,
),
);
};
开发者ID:Volune,项目名称:jest,代码行数:10,代码来源:normalize.ts
示例4: _addUntestedFiles
private async _addUntestedFiles(
globalConfig: Config.GlobalConfig,
contexts: Set<Context>,
): Promise<void> {
const files: Array<{config: Config.ProjectConfig; path: string}> = [];
contexts.forEach(context => {
const config = context.config;
if (
globalConfig.collectCoverageFrom &&
globalConfig.collectCoverageFrom.length
) {
context.hasteFS
.matchFilesWithGlob(globalConfig.collectCoverageFrom, config.rootDir)
.forEach(filePath =>
files.push({
config,
path: filePath,
}),
);
}
});
if (!files.length) {
return;
}
if (isInteractive) {
process.stderr.write(
RUNNING_TEST_COLOR('Running coverage on untested files...'),
);
}
let worker: CoverageWorker | Worker;
if (this._globalConfig.maxWorkers <= 1) {
worker = require('./coverage_worker');
} else {
worker = new Worker(require.resolve('./coverage_worker'), {
exposedMethods: ['worker'],
maxRetries: 2,
numWorkers: this._globalConfig.maxWorkers,
});
}
const instrumentation = files.map(async fileObj => {
const filename = fileObj.path;
const config = fileObj.config;
if (!this._coverageMap.data[filename] && 'worker' in worker) {
try {
const result = await worker.worker({
config,
globalConfig,
options: {
...this._options,
changedFiles:
this._options.changedFiles &&
Array.from(this._options.changedFiles),
},
path: filename,
});
if (result) {
this._coverageMap.addFileCoverage(result.coverage);
if (result.sourceMapPath) {
this._sourceMapStore.registerURL(filename, result.sourceMapPath);
}
}
} catch (error) {
console.error(
chalk.red(
[
`Failed to collect coverage from ${filename}`,
`ERROR: ${error.message}`,
`STACK: ${error.stack}`,
].join('\n'),
),
);
}
}
});
try {
await Promise.all(instrumentation);
} catch (err) {
// Do nothing; errors were reported earlier to the console.
}
if (isInteractive) {
clearLine(process.stderr);
}
if (worker && 'end' in worker && typeof worker.end === 'function') {
worker.end();
}
}
开发者ID:facebook,项目名称:jest,代码行数:98,代码来源:coverage_reporter.ts
注:本文中的jest-util.clearLine函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论