mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-19 12:34:32 +08:00
This PR uses a new Karma plugin to enable vendor bundles in unit tests, increasing rebuild performance. On a medium size project rebuilds times were 15x smaller (16.5s to 0.9s). Fix #5423
34 lines
844 B
TypeScript
34 lines
844 B
TypeScript
const webpackMerge = require('webpack-merge');
|
|
|
|
import { BuildOptions } from './build-options';
|
|
import { NgCliWebpackConfig } from './webpack-config';
|
|
import {
|
|
getCommonConfig,
|
|
getStylesConfig,
|
|
getNonAotTestConfig,
|
|
getTestConfig
|
|
} from './webpack-configs';
|
|
|
|
export interface WebpackTestOptions extends BuildOptions {
|
|
codeCoverage?: boolean;
|
|
}
|
|
export class WebpackTestConfig extends NgCliWebpackConfig {
|
|
constructor(private testOptions: WebpackTestOptions, appConfig: any) {
|
|
super(testOptions, appConfig);
|
|
}
|
|
|
|
public buildConfig() {
|
|
let webpackConfigs = [
|
|
getCommonConfig(this.wco),
|
|
getStylesConfig(this.wco),
|
|
this.getTargetConfig(this.wco),
|
|
getNonAotTestConfig(this.wco),
|
|
getTestConfig(this.testOptions)
|
|
];
|
|
|
|
this.config = webpackMerge(webpackConfigs);
|
|
|
|
return this.config;
|
|
}
|
|
}
|