Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/schematics/angular/web-worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ function addSnippet(options: WebWorkerOptions): Rule {
return;
}

const fileRegExp = new RegExp(`^${options.name}.*\.ts`);
const siblingModules = host.getDir(options.path).subfiles
// Find all files that start with the same name, are ts files, and aren't spec files.
.filter(f => f.startsWith(options.name) && f.endsWith('.ts') && !f.endsWith('spec.ts'))
// Find all files that start with the same name, are ts files,
// and aren't spec or module files.
.filter(f => fileRegExp.test(f) && !/(module|spec)\.ts$/.test(f))
// Sort alphabetically for consistency.
.sort();

Expand Down
4 changes: 2 additions & 2 deletions packages/schematics/angular/web-worker/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Schema as WorkspaceOptions } from '../workspace/schema';
import { Schema as WebWorkerOptions } from './schema';


describe('Service Worker Schematic', () => {
describe('Web Worker Schematic', () => {
const schematicRunner = new SchematicTestRunner(
'@schematics/angular',
require.resolve('../collection.json'),
Expand All @@ -35,7 +35,7 @@ describe('Service Worker Schematic', () => {
name: 'bar',
inlineStyle: false,
inlineTemplate: false,
routing: false,
routing: true,
Copy link
Collaborator

@alan-agius4 alan-agius4 May 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this value, will ensure that the improved logic is tested.

skipTests: false,
skipPackageJson: false,
};
Expand Down