mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 23:15:56 +08:00
feat(@angular/cli): added argument for karma configuration file (#4564)
Fix #183
This commit is contained in:
parent
217a87e0b0
commit
b9295e08e7
@ -14,6 +14,7 @@ export interface TestOptions {
|
||||
build?: boolean;
|
||||
sourcemap?: boolean;
|
||||
progress?: boolean;
|
||||
config: string;
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +22,7 @@ const TestCommand = EmberTestCommand.extend({
|
||||
availableOptions: [
|
||||
{ name: 'watch', type: Boolean, default: true, aliases: ['w'] },
|
||||
{ name: 'code-coverage', type: Boolean, default: false, aliases: ['cc'] },
|
||||
{ name: 'config', type: String, aliases: ['c'] },
|
||||
{ name: 'single-run', type: Boolean, default: false, aliases: ['sr'] },
|
||||
{ name: 'progress', type: Boolean, default: true},
|
||||
{ name: 'browsers', type: String },
|
||||
|
@ -8,7 +8,8 @@ export default Task.extend({
|
||||
const projectRoot = this.project.root;
|
||||
return new Promise((resolve) => {
|
||||
const karma = requireProjectModule(projectRoot, 'karma');
|
||||
const karmaConfig = path.join(projectRoot, this.project.ngConfig.config.test.karma.config);
|
||||
const karmaConfig = path.join(projectRoot, options.config ||
|
||||
this.project.ngConfig.config.test.karma.config);
|
||||
|
||||
let karmaOptions: any = Object.assign({}, options);
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { ng } from '../../utils/process';
|
||||
import { moveFile } from '../../utils/fs';
|
||||
|
||||
export default function () {
|
||||
// make sure both --watch=false and --single-run work
|
||||
return ng('test', '--single-run')
|
||||
.then(() => ng('test', '--watch=false'));
|
||||
.then(() => ng('test', '--watch=false'))
|
||||
.then(() => moveFile('./karma.conf.js', './karma.conf.bis.js'))
|
||||
.then(() => ng('test', '--single-run', '--config', 'karma.conf.bis.js'));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user