Skip to content

Commit

Permalink
feat(@angular/cli): support test using ngSummaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Quramy committed Oct 11, 2017
1 parent 4b29400 commit e022cce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/@angular/cli/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ const TestCommand = Command.extend({
description: oneLine`Use a specific config file.
Defaults to the karma config file in .angular-cli.json.`
},
{
name: 'aot',
type: Boolean,
description: 'Build using Ahead of Time compilation.'
},
{
name: 'single-run',
type: Boolean,
Expand Down
6 changes: 4 additions & 2 deletions packages/@angular/cli/models/webpack-configs/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ export function getAotConfig(wco: WebpackConfigOptions) {
}

export function getNonAotTestConfig(wco: WebpackConfigOptions) {
const { projectRoot, appConfig } = wco;
const { projectRoot, appConfig, buildOptions } = wco;
const { aot } = buildOptions;
const tsConfigPath = path.resolve(projectRoot, appConfig.root, appConfig.testTsconfig);
const appTsConfigPath = path.resolve(projectRoot, appConfig.root, appConfig.tsconfig);

Expand All @@ -155,7 +156,8 @@ export function getNonAotTestConfig(wco: WebpackConfigOptions) {
// since TS compilation there is stricter and tsconfig.spec.ts doesn't include them.
const include = [appConfig.main, appConfig.polyfills];

let pluginOptions: any = { tsConfigPath, skipCodeGeneration: true, include };
let pluginOptions: any = { tsConfigPath, skipCodeGeneration: !aot,
enableSummariesForJit: aot, include };

// Fallback to correct module format on projects using a shared tsconfig.
if (tsConfigPath === appTsConfigPath) {
Expand Down
1 change: 1 addition & 0 deletions packages/@angular/cli/plugins/karma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
sourcemaps: true,
progress: true,
preserveSymlinks: false,
aot: config.aot,
}, config.angularCli);

if (testConfig.sourcemaps) {
Expand Down

0 comments on commit e022cce

Please sign in to comment.