Skip to content

Commit 9703dfa

Browse files
authored
refactor(tests): Refactor e2e tests entirely. (angular#1986)
1 parent e20af21 commit 9703dfa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8265
-775
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ test_script:
1111
- node --version
1212
- npm --version
1313
- npm test
14+
- npm run test:e2e
1415

1516
build: off

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,22 @@ env:
1313
matrix:
1414
- SCRIPT=lint
1515
# - SCRIPT=build
16+
- SCRIPT=e2e
17+
- SCRIPT=e2e:nightly
1618
- SCRIPT=test
1719
# - TARGET=mobile SCRIPT=mobile_test
1820
matrix:
1921
fast_finish: true
2022
allow_failures:
2123
- os: osx
24+
- env: SCRIPT=e2e:nightly
2225
exclude:
2326
- node_js: "6"
2427
env: SCRIPT=lint
28+
- os: osx
29+
env: SCRIPT=e2e:nightly
30+
- node_js: "6"
31+
env: SCRIPT=e2e:nightly
2532
- os: osx
2633
node_js: "5"
2734
env: SCRIPT=lint

addon/ng2/blueprints/component/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var path = require('path');
22
var chalk = require('chalk');
33
var Blueprint = require('ember-cli/lib/models/blueprint');
44
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
5-
const findParentModule = require('../../utilities/find-parent-module');
5+
const findParentModule = require('../../utilities/find-parent-module').default;
66
var getFiles = Blueprint.prototype.files;
77
const stringUtils = require('ember-cli-string-utils');
88
const astUtils = require('../../utilities/ast-utils');
@@ -111,12 +111,12 @@ module.exports = {
111111
const returns = [];
112112
const className = stringUtils.classify(`${options.entity.name}Component`);
113113
const fileName = stringUtils.dasherize(`${options.entity.name}.component`);
114-
const componentDir = path.relative(this.dynamicPath.appRoot, this.generatePath);
114+
const componentDir = path.relative(path.dirname(this.pathToModule), this.generatePath);
115115
const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`;
116116

117117
if (!options['skip-import']) {
118118
returns.push(
119-
astUtils.addComponentToModule(this.pathToModule, className, importPath)
119+
astUtils.addDeclarationToModule(this.pathToModule, className, importPath)
120120
.then(change => change.apply()));
121121
}
122122

addon/ng2/blueprints/directive/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var path = require('path');
22
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
33
const stringUtils = require('ember-cli-string-utils');
44
const astUtils = require('../../utilities/ast-utils');
5-
const findParentModule = require('../../utilities/find-parent-module');
5+
const findParentModule = require('../../utilities/find-parent-module').default;
66

77
module.exports = {
88
description: '',
@@ -72,7 +72,7 @@ module.exports = {
7272

7373
if (!options['skip-import']) {
7474
returns.push(
75-
astUtils.addComponentToModule(this.pathToModule, className, importPath)
75+
astUtils.addDeclarationToModule(this.pathToModule, className, importPath)
7676
.then(change => change.apply()));
7777
}
7878

addon/ng2/blueprints/ng2/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121

2222
locals: function(options) {
2323
this.styleExt = options.style;
24-
this.version = require(path.resolve(__dirname, '..', '..', '..', '..', 'package.json')).version;
24+
this.version = require(path.resolve(__dirname, '../../../../package.json')).version;
2525

2626
// Join with / not path.sep as reference to typings require forward slashes.
2727
const relativeRootPath = options.sourceDir.split(path.sep).map(() => '..').join('/');
@@ -44,12 +44,11 @@ module.exports = {
4444

4545
files: function() {
4646
var fileList = getFiles.call(this);
47-
4847
if (this.options && this.options.mobile) {
4948
fileList = fileList.filter(p => p.indexOf('__name__.component.html') < 0);
5049
fileList = fileList.filter(p => p.indexOf('__name__.component.__styleext__') < 0);
5150
}
52-
51+
5352
return fileList;
5453
},
5554

addon/ng2/blueprints/pipe/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var path = require('path');
22
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
33
const stringUtils = require('ember-cli-string-utils');
44
const astUtils = require('../../utilities/ast-utils');
5-
const findParentModule = require('../../utilities/find-parent-module');
5+
const findParentModule = require('../../utilities/find-parent-module').default;
66

77
module.exports = {
88
description: '',
@@ -60,7 +60,7 @@ module.exports = {
6060

6161
if (!options['skip-import']) {
6262
returns.push(
63-
astUtils.addComponentToModule(this.pathToModule, className, importPath)
63+
astUtils.addDeclarationToModule(this.pathToModule, className, importPath)
6464
.then(change => change.apply()));
6565
}
6666

addon/ng2/commands/init.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
import LinkCli from '../tasks/link-cli';
42

53
const Command = require('ember-cli/lib/models/command');

addon/ng2/models/find-lazy-modules.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ export function findLazyModules(projectRoot: any): string[] {
5757
findLoadChildren(tsPath).forEach(moduleName => {
5858
const fileName = path.resolve(path.dirname(tsPath), moduleName) + '.ts';
5959
if (fs.existsSync(fileName)) {
60-
result[moduleName] = true;
60+
// Put the moduleName as relative to the main.ts.
61+
const fullPath = path.resolve(path.dirname(tsPath), moduleName);
62+
const name = `./${path.relative(projectRoot, fullPath)}.ts`;
63+
result[name] = true;
6164
}
6265
});
6366
});

addon/ng2/utilities/ast-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export {
77
insertAfterLastOccurrence,
88
getContentOfKeyLiteral,
99
getDecoratorMetadata,
10-
addComponentToModule,
10+
addDeclarationToModule,
1111
addProviderToModule
1212
} from '@angular-cli/ast-tools';

addon/ng2/utilities/find-parent-module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import * as fs from 'fs';
22
import * as path from 'path';
33
const SilentError = require('silent-error');
44

5-
module.exports = function findParentModule(project: any, currentDir: string): string {
6-
5+
export default function findParentModule(project: any, currentDir: string): string {
76
const sourceRoot = path.join(project.root, project.ngConfig.apps[0].root, 'app');
87

98
// trim currentDir

lib/bootstrap-local.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require.extensions['.ts'] = function(m, filename) {
2424
const source = fs.readFileSync(filename).toString();
2525

2626
try {
27-
const result = ts.transpile(source, compilerOptions);
27+
const result = ts.transpile(source, compilerOptions['compilerOptions']);
2828

2929
// Send it to node to execute.
3030
return m._compile(result, filename);

0 commit comments

Comments
 (0)