@@ -9,15 +9,10 @@ var validProjectName = require('ember-cli/lib/utilities/valid-project-name');
9
9
var normalizeBlueprint = require ( 'ember-cli/lib/utilities/normalize-blueprint-option' ) ;
10
10
11
11
var TestCommand = require ( 'ember-cli/lib/commands/test' ) ;
12
+ var TestTask = require ( '../tasks/test' ) ;
12
13
var win = require ( 'ember-cli/lib/utilities/windows-admin' ) ;
13
14
var path = require ( 'path' ) ;
14
15
15
- // require dependencies within the target project
16
- function requireDependency ( root , moduleName ) {
17
- var packageJson = require ( path . join ( root , 'node_modules' , moduleName , 'package.json' ) ) ;
18
- var main = path . normalize ( packageJson . main ) ;
19
- return require ( path . join ( root , 'node_modules' , moduleName , main ) ) ;
20
- }
21
16
22
17
module . exports = TestCommand . extend ( {
23
18
availableOptions : [
@@ -37,6 +32,11 @@ module.exports = TestCommand.extend({
37
32
analytics : this . analytics ,
38
33
project : this . project
39
34
} ) ;
35
+ var testTask = new TestTask ( {
36
+ ui : this . ui ,
37
+ analytics : this . analytics ,
38
+ project : this . project
39
+ } ) ;
40
40
41
41
var buildCommandOptions = {
42
42
environment : 'development' ,
@@ -51,19 +51,7 @@ module.exports = TestCommand.extend({
51
51
return buildTask . run ( buildCommandOptions ) ;
52
52
} )
53
53
. then ( function ( ) {
54
- return new Promise ( function ( resolve , reject ) {
55
- var karma = requireDependency ( projectRoot , 'karma' ) ;
56
- var karmaConfig = path . join ( projectRoot , 'karma.conf' ) ;
57
-
58
- // Convert browsers from a string to an array
59
- if ( commandOptions . browsers ) {
60
- commandOptions . browsers = commandOptions . browsers . split ( ',' ) ;
61
- }
62
- commandOptions . configFile = karmaConfig ;
63
- var karmaServer = new karma . Server ( commandOptions , resolve ) ;
64
-
65
- karmaServer . start ( ) ;
66
- } ) ;
54
+ return testTask . run ( commandOptions ) ;
67
55
} ) ;
68
56
}
69
57
} ) ;
0 commit comments