forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(command): ng test command runs karma
Overrode the ember-cli test command to initialize the karma server Then start the karma server based upon the karma.conf.js config file closes angular#70
- Loading branch information
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
var chalk = require('chalk'); | ||
var Command = require('ember-cli/lib/models/command'); | ||
var Promise = require('ember-cli/lib/ext/promise'); | ||
var Project = require('ember-cli/lib/models/project'); | ||
var SilentError = require('silent-error'); | ||
var validProjectName = require('ember-cli/lib/utilities/valid-project-name'); | ||
var normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option'); | ||
|
||
var TestCommand = require('ember-cli/lib/commands/test'); | ||
var childProcess = require('child_process') | ||
|
||
module.exports = TestCommand.extend({ | ||
|
||
init: function(){ | ||
var cwd = process.cwd(); | ||
this.karma = this.karma || require(cwd + '/node_modules/karma/lib/index'); | ||
this.karmaConfig = this.karmaConfig || cwd + '/karma.conf'; | ||
this.server = this.server || new this.karma.Server({configFile: this.karmaConfig}); | ||
}, | ||
|
||
run: function(commandOptions, rawArgs) { | ||
var promise = new Promise(function(){}); | ||
|
||
this.server.start(); | ||
|
||
return promise; | ||
} | ||
}); | ||
|
||
module.exports.overrideCore = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs-extra'); | ||
var ng = require('../helpers/ng'); | ||
var existsSync = require('exists-sync'); | ||
var expect = require('chai').expect; | ||
var forEach = require('lodash/collection/forEach'); | ||
var walkSync = require('walk-sync'); | ||
var Blueprint = require('ember-cli/lib/models/blueprint'); | ||
var path = require('path'); | ||
var tmp = require('../helpers/tmp'); | ||
var root = process.cwd(); | ||
var util = require('util'); | ||
var conf = require('ember-cli/tests/helpers/conf'); | ||
var EOL = require('os').EOL; | ||
|
||
describe('Acceptance: ng test', function () { | ||
before(conf.setup); | ||
|
||
after(conf.restore); | ||
|
||
beforeEach(function () { | ||
return tmp.setup('./tmp') | ||
.then(function () { | ||
process.chdir('./tmp'); | ||
}) | ||
.then(function () { | ||
return ng([ | ||
'init', | ||
'--skip-npm', | ||
'--skip-bower' | ||
]); | ||
}); | ||
}); | ||
|
||
afterEach(function () { | ||
this.timeout(10000); | ||
|
||
return tmp.teardown('./tmp'); | ||
}); | ||
|
||
it('ng test should excecute a test', function () { | ||
console.log('starting test'); | ||
return ng([ | ||
'test', | ||
'--skip-npm', | ||
'--skip-bower' | ||
]) | ||
.then(function () { | ||
console.log('test completed'); | ||
}); | ||
}); | ||
}); |