本文整理匯總了TypeScript中@angular-devkit/schematics.Tree.empty方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Tree.empty方法的具體用法?TypeScript Tree.empty怎麽用?TypeScript Tree.empty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular-devkit/schematics.Tree
的用法示例。
在下文中一共展示了Tree.empty方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('works', () => {
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = runner.runSchematic('my-full-schematic', { required: 'str' }, Tree.empty());
// Listing files
expect(tree.files.sort()).toEqual(['/allo', '/hola']);
});
示例2: it
it('works', () => {
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = runner.runSchematic('add', {
module: 'app'
}, Tree.empty());
expect(tree.files).toEqual(['/hello']);
});
示例3: it
it(`should install version ${prefix}6.0.0`, () => {
appTree = new UnitTestTree(Tree.empty());
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = createPackageJson(prefix, pkgName, appTree);
const newTree = runner.runSchematic(
`ngrx-${pkgName}-migration-01`,
{},
tree
);
const pkg = JSON.parse(newTree.readContent(packagePath));
expect(pkg.dependencies[`@ngrx/${pkgName}`]).toBe(
`${prefix}${upgradeVersion}`
);
});
示例4: beforeEach
beforeEach(() => {
tree = Tree.empty() as UnitTestTree;
tree.create('/package.json', `{}`);
});
示例5: it
it('works', () => {
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = runner.runSchematic('new-component', {}, Tree.empty());
expect(tree.files).toEqual([]);
});
示例6: it
it('works', () => {
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = runner.runSchematic('my-other-schematic', {}, Tree.empty());
expect(tree.files.sort()).toEqual(['/allo', '/hola']);
});
示例7: expect
expect(() => runner.runSchematic('my-full-schematic', {}, Tree.empty())).toThrow();