MCPcopy Index your code
hub / github.com/angular/angular-cli / testRule

Function testRule

packages/schematics/angular/utility/dependency_spec.ts:32–52  ·  view source on GitHub ↗
(
  rule: Rule,
  tree: Tree,
)

Source from the content-addressed store, hash-verified

30}
31
32async function testRule(
33 rule: Rule,
34 tree: Tree,
35): Promise<{ tasks: TaskConfigurationGenerator[]; logs: LogEntry[] }> {
36 const tasks: TaskConfigurationGenerator[] = [];
37 const logs: LogEntry[] = [];
38 const context = {
39 addTask(task: TaskConfigurationGenerator) {
40 tasks.push(task);
41 },
42 logger: {
43 warn(message: string): void {
44 logs.push({ type: 'warn', message });
45 },
46 },
47 };
48
49 await callRule(rule, tree, context as unknown as SchematicContext).toPromise();
50
51 return { tasks, logs };
52}
53
54describe('addDependency', () => {
55 it('adds a package to "dependencies" by default', async () => {

Callers 1

dependency_spec.tsFile · 0.70

Calls 1

callRuleFunction · 0.90

Tested by

no test coverage detected