Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('works with template files exclusively', done => {
const tree = new UnitTestTree(new HostTree());
tree.create('a/b/file1', 'hello world');
tree.create('a/b/file2', 'hello world');
tree.create('a/b/file3.template', 'hello <%= 1 %> world');
tree.create('a/b/file__a__.template', 'hello <%= 1 %> world');
tree.create('a/b/file__norename__', 'hello <%= 1 %> world');
tree.create('a/c/file4', 'hello world');
const context: SchematicContext = {
strategy: MergeStrategy.Default,
} as SchematicContext;
// Rename all files that contain 'b' to 'hello'.
callRule(applyTemplates({ a: 'foo' }), observableOf(tree), context)
.toPromise()
.then(() => {
expect([...tree.files].sort()).toEqual([
beforeEach(() => {
treeBefore = new UnitTestTree(Tree.empty());
runner = new SchematicTestRunner('schematics', collectionPath);
});
beforeEach(() => {
project = new UnitTestTree(Tree.empty());
project.create('tsconfig.json', JSON.stringify({}));
runner = new SchematicTestRunner('schematics', collectionPath);
});
beforeEach(() => {
const config = { apps: [{ root: 'src' }] };
collectionPath = join(__dirname, '../collection.json');
runner = new SchematicTestRunner('kentan', collectionPath);
childLogger = {
info: jest.fn(),
fatal: jest.fn()
};
logger = { createChild: () => childLogger };
runner['_logger'] = logger;
tree = new UnitTestTree(new VirtualTree());
tree.create('.angular-cli.json', JSON.stringify(config));
UseMock.globalCliConfiguration();
});
beforeEach(() => {
appTree = new UnitTestTree(new EmptyTree());
});
beforeEach(async () => {
tree = new UnitTestTree(new EmptyTree());
tree.create('/package.json', JSON.stringify({}));
});
beforeEach(() => {
tree = new UnitTestTree(new EmptyTree());
tree.create(configPath, JSON.stringify(baseConfig, null, 2));
tree.create(packageJsonPath, JSON.stringify(packageJson, null, 2));
tree.create(tslintPath, JSON.stringify(tslintConfig, null, 2));
});
beforeEach(() => {
tree = new UnitTestTree(new EmptyTree());
tree.create(packageJsonPath, JSON.stringify(packageJson, null, 2));
});
beforeEach(() => {
appTree = new UnitTestTree(Tree.empty());
appTree.create(
'/tsconfig.json',
`
{
"include": [**./*.ts"]
}
`
);
createPackageJson('', pkgName, appTree);
});