Skip to content

Commit

Permalink
fix(@schematics/angular): remove angularCli in Karma when updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Teamop authored and hansl committed Jun 6, 2018
1 parent c84fa4b commit 06589b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/schematics/angular/migrations/update-6/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function migrateKarmaConfiguration(config: CliConfig): Rule {
content = content.replace(`{ pattern: './src/test.ts', watched: false }`, '');
content = content.replace(`'./src/test.ts': ['@angular/cli'],`, '');
content = content.replace(`'./src/test.ts': ['@angular/cli']`, '');
content = content.replace(/angularCli[^}]*},?/, '');
// Replace 1.x plugin names.
content = content.replace(/@angular\/cli/g, '@angular-devkit/build-angular');
// Replace code coverage output path.
Expand Down
4 changes: 4 additions & 0 deletions packages/schematics/angular/migrations/update-6/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,17 @@ describe('Migration to v6', () => {
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
angularCli: {
environment: 'dev'
},
`);

tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const content = tree.readContent(karmaPath);
expect(content).not.toContain(`{ pattern: './src/test.ts', watched: false }`);
expect(content).not.toContain(`'./src/test.ts': ['@angular/cli']`);
expect(content).not.toMatch(/angularCli[^}]*},?/);
});
});

Expand Down

0 comments on commit 06589b4

Please sign in to comment.