Skip to content

Commit b40b073

Browse files
committed
chore: move test config files to config dir.
1 parent f23bf22 commit b40b073

File tree

8 files changed

+14
-9
lines changed

8 files changed

+14
-9
lines changed

addon/ng2/blueprints/ng2/files/angular-cli.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
"packages": [],
1111
"e2e": {
1212
"protractor": {
13-
"config": "protractor.conf.js"
13+
"config": "config/protractor.conf.js"
1414
}
1515
},
1616
"test": {
1717
"karma": {
18-
"config": "karma.conf.js"
18+
"config": "config/karma.conf.js"
1919
}
2020
},
2121
"defaults": {

addon/ng2/blueprints/ng2/files/karma.conf.js renamed to addon/ng2/blueprints/ng2/files/config/karma.conf.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = function (config) {
22
config.set({
3-
basePath: '',
3+
basePath: '..',
44
frameworks: ['jasmine'],
55
plugins: [
66
require('karma-jasmine'),
@@ -26,8 +26,7 @@ module.exports = function (config) {
2626
{ pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true },
2727
{ pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true },
2828

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

3231
// paths loaded via module imports
3332
{ pattern: 'dist/**/*.js', included: false, watched: true },

addon/ng2/blueprints/ng2/files/protractor.conf.js renamed to addon/ng2/blueprints/ng2/files/config/protractor.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var SpecReporter = require('jasmine-spec-reporter');
44
exports.config = {
55
allScriptsTimeout: 11000,
66
specs: [
7-
'e2e/**/*.e2e.ts'
7+
'../e2e/**/*.e2e.ts'
88
],
99
capabilities: {
1010
'browserName': 'chrome'

addon/ng2/commands/e2e.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
'use strict';
33

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

78
module.exports = Command.extend({
89
name: 'e2e',
910
description: 'Run e2e tests in existing project',
1011
works: 'insideProject',
1112
run: function () {
13+
this.project.ngConfig = this.project.ngConfig || config.CliConfig.fromProject();
14+
1215
var e2eTask = new E2ETask({
1316
ui: this.ui,
1417
analytics: this.analytics,

addon/ng2/commands/test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var TestCommand = require('ember-cli/lib/commands/test');
55
var win = require('ember-cli/lib/utilities/windows-admin');
66
var BuildTask = require('ember-cli/lib/tasks/build');
77
var BuildWatchTask = require('ember-cli/lib/tasks/build-watch');
8+
const config = require('../models/config');
89
var TestTask = require('../tasks/test');
910

1011

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

2122
run: function (commandOptions) {
23+
this.project.ngConfig = this.project.ngConfig || config.CliConfig.fromProject();
24+
2225
var buildWatchTask =
2326
new BuildWatchTask({
2427
ui: this.ui,

addon/ng2/tasks/e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ var exec = Promise.denodeify(require('shelljs').exec);
77

88
module.exports = Task.extend({
99
run: function () {
10-
return exec('npm run e2e');
10+
return exec(`npm run e2e -- ${this.project.ngConfig.e2e.protractor.config}`);
1111
}
1212
});

addon/ng2/tasks/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ module.exports = Task.extend({
1616

1717
run: function (options) {
1818
var projectRoot = this.project.root;
19-
return new Promise(function (resolve) {
19+
return new Promise((resolve) => {
2020
var karma = requireDependency(projectRoot, 'karma');
21-
var karmaConfig = path.join(projectRoot, 'karma.conf');
21+
var karmaConfig = path.join(projectRoot, this.project.ngConfig.test.karma.config);
2222

2323
// Convert browsers from a string to an array
2424
if (options.browsers) {

0 commit comments

Comments
 (0)