diff --git a/packages/schematics/angular/pipe/index.ts b/packages/schematics/angular/pipe/index.ts index 5b76749a5643..7e3d5e19b156 100644 --- a/packages/schematics/angular/pipe/index.ts +++ b/packages/schematics/angular/pipe/index.ts @@ -96,12 +96,12 @@ export default function (options: PipeOptions): Rule { options.path = buildDefaultPath(project); } + options.module = findModuleFromOptions(host, options); + const parsedPath = parseName(options.path, options.name); options.name = parsedPath.name; options.path = parsedPath.path; - options.module = findModuleFromOptions(host, options); - // todo remove these when we remove the deprecations options.skipTests = options.skipTests || !options.spec; diff --git a/packages/schematics/angular/pipe/index_spec.ts b/packages/schematics/angular/pipe/index_spec.ts index 50263fd34c0c..7872dd04f799 100644 --- a/packages/schematics/angular/pipe/index_spec.ts +++ b/packages/schematics/angular/pipe/index_spec.ts @@ -79,6 +79,20 @@ describe('Pipe Schematic', () => { expect(thrownError).toBeDefined(); }); + it('should handle a path in the name and module options', () => { + appTree = schematicRunner.runSchematic( + 'module', + { name: 'admin/module', project: 'bar' }, + appTree, + ); + + const options = { ...defaultOptions, module: 'admin/module' }; + appTree = schematicRunner.runSchematic('pipe', options, appTree); + + const content = appTree.readContent('/projects/bar/src/app/admin/module/module.module.ts'); + expect(content).toMatch(/import { FooPipe } from '\.\.\/\.\.\/foo.pipe'/); + }); + it('should export the pipe', () => { const options = { ...defaultOptions, export: true };