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


TypeScript mocha.run函数代码示例

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


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

示例1: Mocha

const runMocha = (baseDir: string, mochaOptions, proc: NodeJS.Process) => {
  const mocha = new Mocha(mochaOptions);

  const testFiles = getTestFiles(baseDir);

  _.forEach(testFiles, (testFile) => mocha.addFile(testFile));

  // exit with non-zero (error) status if there were failures
  mocha.run((failures) => {
    proc.on('exit', () => proc.exit(failures));
  });

  return testFiles;
};
开发者ID:zthomae,项目名称:xanadu,代码行数:14,代码来源:test.ts

示例2: Promise

  return new Promise(function(resolve, reject) {
    const testRunner = new Mocha();
    testRunner.timeout(TIMEOUT);
    testRunner.reporter('spec');

    const files = glob.sync(`${TEST_DIR}/**/**.js`);
    files.forEach(function(file) {
      testRunner.addFile(file);
    });
    try {
      testRunner.run(function(failures) {
        process.exit(failures);
        resolve();
      });
    } catch (err) {
      return reject(err);
    }
  });
开发者ID:bitjson,项目名称:bitcore,代码行数:18,代码来源:unit.ts

示例3: require

    path = require('path');

// Instantiate a Mocha instance.
var mocha = new Mocha();

var testDir = 'uuid';

// Add each .js file to the mocha instance
fs.readdirSync(testDir).filter(function (file) {
    // Only keep the .js files
    return file.substr(-3) === '.js';

}).forEach(function (file) {
    mocha.addFile(
        path.join(testDir, file)
    );
});


try {
    // Run the tests.
    mocha.run(function (failures) {

        console.log(failures);

    });
} catch (e) {
    console.log('Erro ao executar os testes', e);
}

开发者ID:ffarzat,项目名称:Typescript-Tests,代码行数:29,代码来源:app.ts

示例4: require

/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

const MochaTest = require('mocha');

const mochaTest = new MochaTest({
	timeout: 60000,
	slow: 10000,
	useColors: true
});
mochaTest.addFile(require('path').join(process.cwd(), 'out/test.js'));
mochaTest.run((failures) => {
	process.exit(failures);
});
开发者ID:kieferrm,项目名称:vscode,代码行数:16,代码来源:mocha-runner.ts

示例5: require

process.env.TS_NODE_PROJECT = './tsconfig.spec.json';
import 'reflect-metadata';

require('ts-mocha');
const Mocha = require('mocha');

const mocha = new Mocha();
mocha.addFile(`./tests-ssr/todo.mocha.ts`);
mocha.addFile(`./tests-ssr/exit.mocha.ts`);
mocha.run((failures: number) => {
  process.on('exit', () => {
    process.exit(failures); // exit with non-zero status if there were failures
  });
});
开发者ID:LucasFrecia,项目名称:store,代码行数:14,代码来源:test.ssr.ts


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