Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): clear context in Karma by default…
Browse files Browse the repository at this point in the history
… for single run executions

This works around angular#28271.
  • Loading branch information
dgp1130 committed Aug 29, 2024
1 parent 7f570c5 commit e6c2c4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ export function execute(
logger: context.logger,
};

// Workaround https://github.com/angular/angular-cli/issues/28271, by clearing context by default
// for single run executions.
if (karmaOptions.client?.clearContext === undefined) {
const singleRun = karmaOptions.singleRun ?? false; // Defaults to `false` per Karma docs.
karmaOptions.client ??= {};
karmaOptions.client.clearContext = singleRun;
}

const parsedKarmaConfig = await karma.config.parseConfig(
options.karmaConfig && path.resolve(context.workspaceRoot, options.karmaConfig),
transforms.karmaOptions ? transforms.karmaOptions(karmaOptions) : karmaOptions,
Expand Down Expand Up @@ -208,9 +216,6 @@ function getBuiltInKarmaConfig(
'karma-coverage',
'@angular-devkit/build-angular/plugins/karma',
].map((p) => workspaceRootRequire(p)),
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = function (config) {
// 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
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
Expand Down

0 comments on commit e6c2c4f

Please sign in to comment.