schematic-test-runner.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @license
  3. * Copyright Google Inc. All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { logging } from '@angular-devkit/core';
  9. import { Observable } from 'rxjs';
  10. import { DelegateTree, Rule, SchematicContext, SchematicEngine, TaskConfiguration, Tree } from '../src';
  11. export declare class UnitTestTree extends DelegateTree {
  12. readonly files: string[];
  13. readContent(path: string): string;
  14. }
  15. export declare class SchematicTestRunner {
  16. private _collectionName;
  17. private _engineHost;
  18. private _engine;
  19. private _collection;
  20. private _logger;
  21. constructor(_collectionName: string, collectionPath: string);
  22. readonly engine: SchematicEngine<{}, {}>;
  23. readonly logger: logging.Logger;
  24. readonly tasks: TaskConfiguration[];
  25. registerCollection(collectionName: string, collectionPath: string): void;
  26. runSchematicAsync<SchematicSchemaT>(schematicName: string, opts?: SchematicSchemaT, tree?: Tree): Observable<UnitTestTree>;
  27. /**
  28. * @deprecated Since v8.0.0 - Use {@link SchematicTestRunner.runSchematicAsync} instead.
  29. * All schematics can potentially be async.
  30. * This synchronous variant will fail if the schematic, any of its rules, or any schematics
  31. * it calls are async.
  32. */
  33. runSchematic<SchematicSchemaT>(schematicName: string, opts?: SchematicSchemaT, tree?: Tree): UnitTestTree;
  34. runExternalSchematicAsync<SchematicSchemaT>(collectionName: string, schematicName: string, opts?: SchematicSchemaT, tree?: Tree): Observable<UnitTestTree>;
  35. /**
  36. * @deprecated Since v8.0.0 - Use {@link SchematicTestRunner.runExternalSchematicAsync} instead.
  37. * All schematics can potentially be async.
  38. * This synchronous variant will fail if the schematic, any of its rules, or any schematics
  39. * it calls are async.
  40. */
  41. runExternalSchematic<SchematicSchemaT>(collectionName: string, schematicName: string, opts?: SchematicSchemaT, tree?: Tree): UnitTestTree;
  42. callRule(rule: Rule, tree: Tree, parentContext?: Partial<SchematicContext>): Observable<Tree>;
  43. }