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


TypeScript jasmine.onComplete函数代码示例

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


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

示例1: Promise

  return new Promise(resolve => {
    runner.onComplete((passed: boolean) => resolve(passed ? 0 : 1));
    if (args.seed != undefined) {
      runner.seed(args.seed);
    }

    runner.execute(tests, args.filter);
  });
开发者ID:angular,项目名称:angular-cli,代码行数:8,代码来源:test.ts

示例2: require

export const runTests = (specFiles: string[], helpers?: string[]) => {
  // We can't use `import` here, because of the following mess:
  // - GitHub project `jasmine/jasmine` is `jasmine-core` on npm and its typings `@types/jasmine`.
  // - GitHub project `jasmine/jasmine-npm` is `jasmine` on npm and has no typings.
  //
  // Using `import...from 'jasmine'` here, would import from `@types/jasmine` (which refers to the
  // `jasmine-core` module and the `jasmine` module).
  // tslint:disable-next-line: no-var-requires variable-name
  const Jasmine = require('jasmine');
  const config = {
    helpers,
    random: true,
    spec_files: specFiles,
    stopSpecOnExpectationFailure: true,
  };

  process.on('unhandledRejection', (reason: any) => console.log('Unhandled rejection:', reason));

  const runner = new Jasmine();
  runner.loadConfig(config);
  runner.onComplete((passed: boolean) => process.exit(passed ? 0 : 1));
  runner.execute();
};
开发者ID:AnthonyPAlicea,项目名称:angular,代码行数:23,代码来源:run-tests.ts

示例3: Promise

 return new Promise(resolve => {
   runner.onComplete((passed: boolean) => resolve(passed ? 0 : 1));
   runner.execute(tests);
 });
开发者ID:DevIntent,项目名称:angular-cli,代码行数:4,代码来源:test.ts

示例4:

      displayErrorMessages: true,
      displayDuration: true,
    },
  }));
}


// Manually set exit code (needed with custom reporters)
runner.onComplete((success: boolean) => {
  process.exitCode = success ? 0 : 1;
  if (process.platform.startsWith('win')) {
    // TODO(filipesilva): finish figuring out why this happens.
    // We should not need to force exit here, but when:
    // - on windows
    // - running webpack-dev-server
    // - with ngtools/webpack on the compilation
    // Something seems to hang and the process never exists.
    // This does not happen on linux, nor with webpack on watch mode.
    // Until this is figured out, we need to exit the process manually after tests finish
    // otherwise appveyor will hang until it timeouts.
    process.exit();
  }
});


glob.sync('packages/**/*.spec.ts')
  .filter(p => !/\/schematics\/.*\/(other-)?files\//.test(p))
  .forEach(path => {
    console.error(`Invalid spec file name: ${path}. You're using the old convention.`);
  });
开发者ID:DevIntent,项目名称:angular-cli,代码行数:30,代码来源:test.ts

示例5: function

let currentRelativePath = path.relative( process.cwd(), __dirname )
let specPath  = path.join( currentRelativePath, "/../../src")

iJasmine.loadConfig({
    "spec_dir":                     specPath,
    "spec_files":                   [ "**/*.spec" + extention ],
    "stopSpecOnExpectationFailure": true,
    "random":                       false,
    "helpers":                      [ "../tests/unit/jasmineCustomMatchers"  + extention ]
});

iJasmine.configureDefaultReporter({});
iJasmine.addReporter( failFast.init() );

iJasmine.onComplete( function( passed ) {
    let exitCode = 1;

    if( passed ) {
        console.log( 'Ola Kala' );
        exitCode = 0;
    }

    iJasmine.exit( exitCode, process.platform, process.version, process.exit, require('exit') );
});

mockWaitForFrame( di );

mockDom( [], function () {
    iJasmine.execute();
});
开发者ID:Izhaki,项目名称:gefri,代码行数:30,代码来源:jasmine.ts

示例6: distAllRequire

              '@angular/core/test/zone/**',
              '@angular/core/test/fake_async_spec.*',
              '@angular/common/test/forms/**',
              '@angular/router/test/route_config/route_config_spec.*',
              '@angular/router/test/integration/bootstrap_spec.*',
              '@angular/integration_test/symbol_inspector/**',
              '@angular/upgrade/**',
              '@angular/examples/**',
              'angular1_router/**',
              'payload_tests/**'
            ]
          });
        })
        .reduce(function(specFiles, paths) { return specFiles.concat(paths); }, []);

jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;

jrunner.configureDefaultReporter({showColors: process.argv.indexOf('--no-color') === -1});

jrunner.onComplete(function(passed) { process.exit(passed ? 0 : 1); });
jrunner.projectBaseDir = path.resolve(__dirname, '../../');
jrunner.specDir = '';
require('./test-cjs-main.js');
require('zone.js/dist/jasmine-patch.js');
distAllRequire('@angular/platform-server/src/parse5_adapter.js').Parse5DomAdapter.makeCurrent();
specFiles.forEach((file) => {
  var r = distAllRequire(file);
  if (r.main) r.main();
});
jrunner.execute();
开发者ID:AmineAfia,项目名称:angular,代码行数:30,代码来源:index.ts

示例7: jasmineDone

  jasmineDone(runDetails: jasmine.RunDetails): void {
    super.jasmineDone(runDetails);
  }
}


// Create a Jasmine runner and configure it.
const runner = new Jasmine({ projectBaseDir: projectBaseDir });

runner.env.clearReporters();
global.benchmarkReporter = new BenchmarkReporter();
runner.env.addReporter(global.benchmarkReporter);


// Manually set exit code (needed with custom reporters)
runner.onComplete((success: boolean) => {
  process.exitCode = success ? 0 : 1;
});


// Run the tests.
const allTests =
  glob.sync('packages/**/*_benchmark.ts')
    .map(p => relative(projectBaseDir, p))
    .filter(p => !/schematics_cli\/schematics\//.test(p));


export default function(_args: {}) {
  runner.execute(allTests);
}
开发者ID:baconwaffles,项目名称:angular-cli,代码行数:30,代码来源:benchmark.ts


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