本文整理汇总了TypeScript中@angular-devkit/schematics/testing.SchematicTestRunner.callRule方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SchematicTestRunner.callRule方法的具体用法?TypeScript SchematicTestRunner.callRule怎么用?TypeScript SchematicTestRunner.callRule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular-devkit/schematics/testing.SchematicTestRunner
的用法示例。
在下文中一共展示了SchematicTestRunner.callRule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('works with a loose version', done => {
const rule = updatePackageJson(['@angular/core', '@angular/compiler'], '~4.1.0', true);
schematicRunner.callRule(rule, inputTree)
.toPromise().then(outputTree => {
const packageJson = JSON.parse(outputTree.read('/package.json') !.toString());
expect(packageJson.dependencies['@angular/core']).toBe('~4.1.3');
expect(packageJson.dependencies['@angular/compiler']).toBe('~4.1.3');
expect(packageJson.dependencies['rxjs']).toMatch(/^\^5\.\d+\.\d+$/);
done();
}, done.fail);
});
示例2: it
it('works with a peer dependencies', done => {
const rule = updatePackageJson(['@angular/compiler'], '4.1.0', false);
schematicRunner.callRule(rule, inputTree)
.subscribe(outputTree => {
const packageJson = JSON.parse(outputTree.read('/package.json') !.toString());
expect(packageJson.dependencies['@angular/core']).toBe('4.1.0');
expect(packageJson.dependencies['@angular/compiler']).toBe('4.1.0');
expect(packageJson.dependencies['rxjs']).toMatch(/^\^5\.\d+\.\d+$/);
done();
}, (err) => done.fail(err));
});