|
8 | 8 |
|
9 | 9 | import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
|
10 | 10 | import { strings } from '@angular-devkit/core';
|
11 |
| -import { Config, ConfigOptions, config, constants } from 'karma'; |
| 11 | +import type { Config, ConfigOptions } from 'karma'; |
12 | 12 | import { createRequire } from 'module';
|
13 | 13 | import * as path from 'path';
|
14 | 14 | import { Observable, from } from 'rxjs';
|
@@ -96,7 +96,7 @@ export function execute(
|
96 | 96 |
|
97 | 97 | const karmaOptions: KarmaConfigOptions = options.karmaConfig
|
98 | 98 | ? {}
|
99 |
| - : getBuiltInKarmaConfig(context.workspaceRoot, projectName); |
| 99 | + : getBuiltInKarmaConfig(karma, context.workspaceRoot, projectName); |
100 | 100 |
|
101 | 101 | karmaOptions.singleRun = singleRun;
|
102 | 102 |
|
@@ -145,7 +145,7 @@ export function execute(
|
145 | 145 | logger: context.logger,
|
146 | 146 | };
|
147 | 147 |
|
148 |
| - const parsedKarmaConfig = await config.parseConfig( |
| 148 | + const parsedKarmaConfig = await karma.config.parseConfig( |
149 | 149 | options.karmaConfig && path.resolve(context.workspaceRoot, options.karmaConfig),
|
150 | 150 | transforms.karmaOptions ? transforms.karmaOptions(karmaOptions) : karmaOptions,
|
151 | 151 | { promiseConfig: true, throwErrors: true },
|
@@ -184,6 +184,7 @@ export function execute(
|
184 | 184 | }
|
185 | 185 |
|
186 | 186 | function getBuiltInKarmaConfig(
|
| 187 | + karma: typeof import('karma'), |
187 | 188 | workspaceRoot: string,
|
188 | 189 | projectName: string,
|
189 | 190 | ): ConfigOptions & Record<string, unknown> {
|
@@ -218,7 +219,7 @@ function getBuiltInKarmaConfig(
|
218 | 219 | reporters: ['progress', 'kjhtml'],
|
219 | 220 | port: 9876,
|
220 | 221 | colors: true,
|
221 |
| - logLevel: constants.LOG_INFO, |
| 222 | + logLevel: karma.constants.LOG_INFO, |
222 | 223 | autoWatch: true,
|
223 | 224 | browsers: ['Chrome'],
|
224 | 225 | restartOnFileChange: true,
|
|
0 commit comments