Skip to content

Commit 5bbac07

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/build-angular): add karma as an optional peer dependency
karma is currently used by the karma builder within this package but is not represented in the dependencies. The can lead to accidental version mismatches as well as package manager hoisting problems due to the package manager not knowing the full dependency set of the package.
1 parent 0bacb6b commit 5bbac07

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/angular_devkit/build_angular/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@
8181
"peerDependencies": {
8282
"@angular/compiler-cli": "^11.0.0 || ^11.0.0-next",
8383
"@angular/localize": "^11.0.0 || ^11.0.0-next",
84+
"karma": "^5.2.0",
8485
"ng-packagr": "^10.0.0",
8586
"typescript": ">=3.9 < 4.1"
8687
},
8788
"peerDependenciesMeta": {
8889
"@angular/localize": {
8990
"optional": true
9091
},
92+
"karma": {
93+
"optional": true
94+
},
9195
"ng-packagr": {
9296
"optional": true
9397
}

packages/angular_devkit/build_angular/src/karma/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { SingleTestTransformLoader } from '../webpack/plugins/single-test-transf
2626
import { findTests } from './find-tests';
2727
import { Schema as KarmaBuilderOptions } from './schema';
2828

29-
// tslint:disable-next-line:no-implicit-dependencies
3029
export type KarmaConfigOptions = import('karma').ConfigOptions & {
3130
buildWebpack?: unknown;
3231
configFile?: string;
@@ -36,7 +35,6 @@ async function initialize(
3635
options: KarmaBuilderOptions,
3736
context: BuilderContext,
3837
webpackConfigurationTransformer?: ExecutionTransformer<webpack.Configuration>,
39-
// tslint:disable-next-line:no-implicit-dependencies
4038
): Promise<[typeof import('karma'), webpack.Configuration]> {
4139
const { config } = await generateBrowserWebpackConfigFromContext(
4240
// only two properties are missing:
@@ -53,7 +51,6 @@ async function initialize(
5351
],
5452
);
5553

56-
// tslint:disable-next-line:no-implicit-dependencies
5754
const karma = await import('karma');
5855

5956
return [

0 commit comments

Comments
 (0)