Skip to content

chore: move test config files to config dir. #567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addon/ng2/blueprints/ng2/files/angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"packages": [],
"e2e": {
"protractor": {
"config": "protractor.conf.js"
"config": "config/protractor.conf.js"
}
},
"test": {
"karma": {
"config": "karma.conf.js"
"config": "config/karma.conf.js"
}
},
"defaults": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = function (config) {
config.set({
basePath: '',
basePath: '..',
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
Expand All @@ -26,8 +26,7 @@ module.exports = function (config) {
{ pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true },
{ pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true },


{ pattern: 'karma-test-shim.js', included: true, watched: true },
{ pattern: 'config/karma-test-shim.js', included: true, watched: true },

// paths loaded via module imports
{ pattern: 'dist/**/*.js', included: false, watched: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/**/*.e2e.ts'
'../e2e/**/*.e2e.ts'
],
capabilities: {
'browserName': 'chrome'
Expand Down
3 changes: 3 additions & 0 deletions addon/ng2/commands/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
'use strict';

var Command = require('ember-cli/lib/models/command');
const config = require('../models/config');
var E2ETask = require('../tasks/e2e');

module.exports = Command.extend({
name: 'e2e',
description: 'Run e2e tests in existing project',
works: 'insideProject',
run: function () {
this.project.ngConfig = this.project.ngConfig || config.CliConfig.fromProject();

var e2eTask = new E2ETask({
ui: this.ui,
analytics: this.analytics,
Expand Down
3 changes: 3 additions & 0 deletions addon/ng2/commands/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var TestCommand = require('ember-cli/lib/commands/test');
var win = require('ember-cli/lib/utilities/windows-admin');
var BuildTask = require('ember-cli/lib/tasks/build');
var BuildWatchTask = require('ember-cli/lib/tasks/build-watch');
const config = require('../models/config');
var TestTask = require('../tasks/test');


Expand All @@ -19,6 +20,8 @@ module.exports = TestCommand.extend({
],

run: function (commandOptions) {
this.project.ngConfig = this.project.ngConfig || config.CliConfig.fromProject();

var buildWatchTask =
new BuildWatchTask({
ui: this.ui,
Expand Down
2 changes: 1 addition & 1 deletion addon/ng2/tasks/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ var exec = Promise.denodeify(require('shelljs').exec);

module.exports = Task.extend({
run: function () {
return exec('npm run e2e');
return exec(`npm run e2e -- ${this.project.ngConfig.e2e.protractor.config}`);
}
});
4 changes: 2 additions & 2 deletions addon/ng2/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ module.exports = Task.extend({

run: function (options) {
var projectRoot = this.project.root;
return new Promise(function (resolve) {
return new Promise((resolve) => {
var karma = requireDependency(projectRoot, 'karma');
var karmaConfig = path.join(projectRoot, 'karma.conf');
var karmaConfig = path.join(projectRoot, this.project.ngConfig.test.karma.config);

// Convert browsers from a string to an array
if (options.browsers) {
Expand Down