本文整理匯總了TypeScript中jasmine.execute函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript execute函數的具體用法?TypeScript execute怎麽用?TypeScript execute使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了execute函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
});
示例2: function
export default function (args: ParsedArgs, logger: logging.Logger) {
const specGlob = args.large ? '*_spec_large.ts' : '*_spec.ts';
const regex = args.glob ? args.glob : `packages/**/${specGlob}`;
if (args['code-coverage']) {
runner.env.addReporter(new IstanbulReporter());
}
// Run the tests.
const allTests =
glob.sync(regex)
.map(p => relative(projectBaseDir, p));
const tsConfigPath = join(__dirname, '../tsconfig.json');
const tsConfig = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
const pattern = '^('
+ (tsConfig.config.exclude as string[])
.map(ex => '('
+ ex.split(/[\/\\]/g).map(f => f
.replace(/[\-\[\]{}()+?.^$|]/g, '\\$&')
.replace(/^\*\*/g, '(.+?)?')
.replace(/\*/g, '[^/\\\\]*'))
.join('[\/\\\\]')
+ ')')
.join('|')
+ ')($|/|\\\\)';
const excludeRe = new RegExp(pattern);
let tests = allTests.filter(x => !excludeRe.test(x));
if (!args.full) {
// Remove the tests from packages that haven't changed.
tests = tests
.filter(p => Object.keys(packages).some(name => {
const relativeRoot = relative(projectBaseDir, packages[name].root);
return p.startsWith(relativeRoot) && packages[name].dirty;
}));
logger.info(`Found ${tests.length} spec files, out of ${allTests.length}.`);
}
runner.execute(tests);
}
示例3: 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();
};
示例4: expect
myFighter.idFight = "1";
myFighter.season = 0;
myFighter.assignedTeam = Team.Blue;
myFighter.isReady = true;
await ActiveFighterRepository.persist(myFighter);
expect(myFighter.createdAt).toBeDefined();
done();
});
it("should load all Active Fighter from fight #1", async function (done) {
let myFighter = new ActiveFighter();
myFighter.initialize();
myFighter.name = "Aelith Blanchette";
myFighter.idFight = "1";
myFighter.season = 0;
myFighter.assignedTeam = Team.Blue;
myFighter.isReady = true;
await ActiveFighterRepository.persist(myFighter);
let actors = await ActiveFighterRepository.loadFromFight("1");
expect(actors.length).toBeGreaterThan(0);
done();
});
});
testSuite.execute();
示例5: require
#!/usr/bin/env node
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
// tslint:disable-next-line:no-require-imports
const jasmineCtor = require('jasmine');
const runner = new jasmineCtor();
runner.loadConfig({spec_files: ['scripts/release_notes/**/*_test.ts']});
runner.execute();
示例6: Promise
return new Promise(resolve => {
runner.onComplete((passed: boolean) => resolve(passed ? 0 : 1));
runner.execute(tests);
});
示例7: join
import * as glob from 'glob';
import 'jasmine';
import { join, relative } from 'path';
const projectBaseDir = join(__dirname, '../..');
require('source-map-support').install({
hookRequire: true,
});
const Jasmine = require('jasmine');
const runner = new Jasmine({ projectBaseDir: projectBaseDir });
const files = `packages/schematics/**/*_spec.ts`;
// const files = `packages/schematics/plugin/*_spec.ts`;
const tests = glob.sync(files).map(p => relative(projectBaseDir, p));
runner.execute(tests);
示例8: mockDom
mockDom( [], function () {
iJasmine.execute();
});
示例9: Jasmine
var jasmineInst = new Jasmine();
global['jasmine'].DEFAULT_TIMEOUT_INTERVAL = 5000;
console.log('Setting up new default JASMINE Suite :)');
console.log('----------------------------------------------------');
// Disable default reporter
jasmineInst.configureDefaultReporter({
print: function () {
}
});
// Add a basic reporter for the console :)
jasmineInst.addReporter(new SpecReporter({
displayStacktrace : 'all',
displayPendingSummary: false,
displayPendingSpec : false
}));
// Add our custom HTML reporter
jasmineInst.addReporter(new BeachDayReporter({
logToConsole : true,
includeAllConsoleLogs: false,
maxTestTime : 2000
}));
jasmineInst.loadConfigFile('jasmine_config.json');
jasmineInst.execute();
示例10: require
'use strict';
var Jasmine = require('jasmine');
var j = new Jasmine();
j.loadConfigFile('spec/support/jasmine.json');
j.configureDefaultReporter({
showColors: true
});
j.execute();