本文整理匯總了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));
});