Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createNgRunner() {
return new SchematicTestRunner(
'schematics',
join('./node_modules/@schematics/angular/collection.json'),
);
}
import { externalSchematic, Rule, Tree } from '@angular-devkit/schematics';
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import { Architect } from '@angular-devkit/architect';
import { TestingArchitectHost } from '@angular-devkit/architect/testing';
import {
createEmptyWorkspace,
MockBuilderContext
} from '@nrwl/workspace/testing';
const testRunner = new SchematicTestRunner(
'@nrwl/storybook',
join(__dirname, '../../collection.json')
);
const migrationRunner = new SchematicTestRunner(
'@nrwl/storybook/migrations',
join(__dirname, '../../migrations.json')
);
export function runSchematic(
schematicName: string,
options: SchemaOptions,
tree: Tree
) {
return testRunner.runSchematicAsync(schematicName, options, tree).toPromise();
}
export function callRule(rule: Rule, tree: Tree) {
return testRunner.callRule(rule, tree).toPromise();
}
import { join } from 'path';
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import { Tree, Rule } from '@angular-devkit/schematics';
const testRunner = new SchematicTestRunner(
'@nrwl/cypress',
join(__dirname, '../../collection.json')
);
const migrationRunner = new SchematicTestRunner(
'@nrwl/cypress/migrations',
join(__dirname, '../../migrations.json')
);
export function runSchematic(schematicName: string, options: any, tree: Tree) {
return testRunner.runSchematicAsync(schematicName, options, tree).toPromise();
}
export function callRule(rule: Rule, tree: Tree) {
return testRunner.callRule(rule, tree).toPromise();
}
beforeEach(() => {
runner = new SchematicTestRunner('schematics', require.resolve('../../collection.json'));
});
const setup = async () => {
const runner = new SchematicTestRunner('schematics', collectionPath);
const appTree = await runner
.runExternalSchematicAsync(
'@schematics/angular',
'ng-new',
{
name: 'test-app',
version: '9.0.0-rc.6',
directory: '.',
},
Tree.empty(),
)
.toPromise();
return { runner, appTree };
};
beforeEach(() => {
runner = new SchematicTestRunner('schematics', require.resolve('../collection.json'));
appTree = createTestApp(runner);
});