Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function getTestArchitect() {
const architectHost = new TestingArchitectHost('/root', '/root');
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const architect = new Architect(architectHost, registry);
await architectHost.addBuilderFromPackage(join(__dirname, '../..'));
return [architect, architectHost] as [Architect, TestingArchitectHost];
}
export async function getTestArchitect() {
const architectHost = new TestingArchitectHost('/root', '/root');
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const architect = new Architect(architectHost, registry);
await architectHost.addBuilderFromPackage(join(__dirname, '../..'));
return [architect, architectHost] as [Architect, TestingArchitectHost];
}
export async function getTestArchitect() {
const architectHost = new TestingArchitectHost('/root', '/root');
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const architect = new Architect(architectHost, registry);
await architectHost.addBuilderFromPackage(join(__dirname, '../..'));
return [architect, architectHost] as [Architect, TestingArchitectHost];
}
export async function getTestArchitect() {
const tmpDir = getTempDir();
const architectHost = new TestingArchitectHost(tmpDir, tmpDir);
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const architect = new Architect(architectHost, registry);
await architectHost.addBuilderFromPackage(join(__dirname, '../..'));
return [architect, architectHost] as [Architect, TestingArchitectHost];
}
async function createArchitect(workspaceRoot: string) {
vfHost = new NodeJsSyncHost();
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const { workspace } = await workspaces.readWorkspace(
workspaceRoot,
workspaces.createWorkspaceHost(vfHost),
);
testArchitectHost = new TestingArchitectHost(workspaceRoot, workspaceRoot,
new WorkspaceNodeModulesArchitectHost(workspace, workspaceRoot));
architect = new Architect(testArchitectHost, registry);
}
async function createArchitect(workspaceRoot: string) {
vfHost = new NodeJsSyncHost();
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const { workspace } = await workspaces.readWorkspace(
workspaceRoot,
workspaces.createWorkspaceHost(vfHost),
);
testArchitectHost = new TestingArchitectHost(workspaceRoot, workspaceRoot,
new WorkspaceNodeModulesArchitectHost(workspace, workspaceRoot));
architect = new Architect(testArchitectHost, registry);
}
beforeEach(async () => {
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const testArchitectHost = new TestingArchitectHost('/root', '/root');
architect = new Architect(testArchitectHost, registry);
await testArchitectHost.addBuilderFromPackage(
path.join(__dirname, '../../..')
);
(devkitArchitect as any).scheduleTargetAndForget = jest
.fn()
.mockReturnValue(
of({
success: true,
baseUrl: 'http://localhost:4200'
})
);
fakeEventEmitter = new EventEmitter();
fork = spyOn(child_process, 'fork').and.returnValue(fakeEventEmitter);
beforeEach(async () => {
await host.initialize().toPromise();
const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
const workspaceSysPath = getSystemPath(host.root());
const { workspace } = await workspaces.readWorkspace(
workspaceSysPath,
workspaces.createWorkspaceHost(host),
);
const architectHost = new TestingArchitectHost(
workspaceSysPath,
workspaceSysPath,
new WorkspaceNodeModulesArchitectHost(workspace, workspaceSysPath),
);
architect = new Architect(architectHost, registry);
});