I've created a schematic that it easy to test because Angular CLI is based on schematics. To create a tree of files that I can inspect, all I have to do is setup an appTree
as follows:
const schematicRunner = new SchematicTestRunner(
'schematics',
path.join(__dirname, './../collection.json'),
);
let appTree: UnitTestTree;
// tslint:disable-next-line:no-any
const workspaceOptions: any = {
name: 'workspace',
newProjectRoot: 'projects',
version: '0.5.0',
};
// tslint:disable-next-line:no-any
const appOptions: any = {
name: 'authtest',
inlineStyle: false,
inlineTemplate: false,
routing: false,
style: 'css',
skipTests: false,
};
beforeEach(() => {
appTree = schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions);
appTree = schematicRunner.runExternalSchematic('@schematics/angular', 'application', appOptions, appTree);
});
Is it possible to create a similar tree of files that I can use when testing my app on a React or Vue project (generated with Create React App and Vue CLI, respectively)?
If not, is there a way to load up a package.json
file into the tree? That's the main file I want to load in order to look for dependencies and choose Angular, React, or Vue templates from my Schematic.