From cef4bbd4cf4c429b0456b2e130a3b1812fde926a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Mon, 28 Feb 2022 15:15:09 +0000 Subject: [PATCH] fix(angular): align root karma config when migrating from angular cli to match the one for new workspaces (#9144) --- .../karma/files/karma.conf.js__tmpl__ | 3 +++ .../{karma.conf.js => karma.conf.js__tmpl__} | 19 ++++++++++++++----- .../schematics/{.gitkeep => __dot__gitkeep} | 0 ...tools.json => tsconfig.tools.json__tmpl__} | 0 .../workspace/src/generators/init/init.ts | 1 + scripts/depcheck/missing.ts | 6 ------ 6 files changed, 18 insertions(+), 11 deletions(-) rename packages/workspace/src/generators/init/files/root/{karma.conf.js => karma.conf.js__tmpl__} (57%) rename packages/workspace/src/generators/init/files/root/tools/schematics/{.gitkeep => __dot__gitkeep} (100%) rename packages/workspace/src/generators/init/files/root/tools/{tsconfig.tools.json => tsconfig.tools.json__tmpl__} (100%) diff --git a/packages/angular/src/generators/karma/files/karma.conf.js__tmpl__ b/packages/angular/src/generators/karma/files/karma.conf.js__tmpl__ index 2fc8ee307d979..aacbcbb5fd758 100644 --- a/packages/angular/src/generators/karma/files/karma.conf.js__tmpl__ +++ b/packages/angular/src/generators/karma/files/karma.conf.js__tmpl__ @@ -24,6 +24,9 @@ module.exports = () => { }, clearContext: false, // leave Jasmine Spec Runner output visible in browser }, + jasmineHtmlReporter: { + suppressAll: true, // removes the duplicated traces + }, coverageReporter: { dir: join(__dirname, './coverage'), subdir: '.', diff --git a/packages/workspace/src/generators/init/files/root/karma.conf.js b/packages/workspace/src/generators/init/files/root/karma.conf.js__tmpl__ similarity index 57% rename from packages/workspace/src/generators/init/files/root/karma.conf.js rename to packages/workspace/src/generators/init/files/root/karma.conf.js__tmpl__ index 2c5a16ceedb8c..aacbcbb5fd758 100644 --- a/packages/workspace/src/generators/init/files/root/karma.conf.js +++ b/packages/workspace/src/generators/init/files/root/karma.conf.js__tmpl__ @@ -12,16 +12,25 @@ module.exports = () => { require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), + require('karma-coverage'), require('@angular-devkit/build-angular/plugins/karma'), ], client: { + jasmine: { + // you can add configuration options for Jasmine here + // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html + // for example, you can disable the random execution with `random: false` + // or set a specific seed with `seed: 4321` + }, clearContext: false, // leave Jasmine Spec Runner output visible in browser }, - coverageIstanbulReporter: { - dir: join(__dirname, '../../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true, + jasmineHtmlReporter: { + suppressAll: true, // removes the duplicated traces + }, + coverageReporter: { + dir: join(__dirname, './coverage'), + subdir: '.', + reporters: [{ type: 'html' }, { type: 'text-summary' }], }, reporters: ['progress', 'kjhtml'], port: 9876, diff --git a/packages/workspace/src/generators/init/files/root/tools/schematics/.gitkeep b/packages/workspace/src/generators/init/files/root/tools/schematics/__dot__gitkeep similarity index 100% rename from packages/workspace/src/generators/init/files/root/tools/schematics/.gitkeep rename to packages/workspace/src/generators/init/files/root/tools/schematics/__dot__gitkeep diff --git a/packages/workspace/src/generators/init/files/root/tools/tsconfig.tools.json b/packages/workspace/src/generators/init/files/root/tools/tsconfig.tools.json__tmpl__ similarity index 100% rename from packages/workspace/src/generators/init/files/root/tools/tsconfig.tools.json rename to packages/workspace/src/generators/init/files/root/tools/tsconfig.tools.json__tmpl__ diff --git a/packages/workspace/src/generators/init/init.ts b/packages/workspace/src/generators/init/init.ts index 3de10d9185433..f683805a22e1e 100755 --- a/packages/workspace/src/generators/init/init.ts +++ b/packages/workspace/src/generators/init/init.ts @@ -823,6 +823,7 @@ function decorateAngularClI(host: Tree) { function addFiles(host: Tree) { generateFiles(host, joinPathFragments(__dirname, './files/root'), '.', { tmpl: '', + dot: '.', }); if (!host.exists('.prettierignore')) { diff --git a/scripts/depcheck/missing.ts b/scripts/depcheck/missing.ts index 0404fc2bda61e..2914af86b39c2 100644 --- a/scripts/depcheck/missing.ts +++ b/scripts/depcheck/missing.ts @@ -99,14 +99,8 @@ const IGNORE_MATCHES = { workspace: [ 'tslint', '@angular-devkit/architect', - '@angular-devkit/build-angular', '@angular-devkit/core', '@angular-devkit/schematics', - 'karma', - 'karma-chrome-launcher', - 'karma-coverage-istanbul-reporter', - 'karma-jasmine', - 'karma-jasmine-html-reporter', 'webpack', 'webpack-dev-server', '@nrwl/cli',