Skip to content

Commit 0dc4681

Browse files
committed
acceptance tests
1 parent 135e0ca commit 0dc4681

File tree

7 files changed

+16
-9
lines changed

7 files changed

+16
-9
lines changed

lib/bootstrap-local.js

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ if (!__dirname.match(new RegExp(`\\${path.sep}node_modules\\${path.sep}`))) {
5353
Module._load = function (request, parent) {
5454
if (request in packages) {
5555
return oldLoad.call(this, packages[request].main, parent);
56+
} else if (request.startsWith('angular-cli/')) {
57+
// We allow deep imports (for now).
58+
// TODO: move tests to inside angular-cli package so they don't have to deep import.
59+
const dir = path.dirname(parent.filename);
60+
const newRequest = path.relative(dir, path.join(__dirname, '../packages', request));
61+
return oldLoad.call(this, newRequest, parent);
5662
} else {
5763
return oldLoad.apply(this, arguments);
5864
}

lib/packages.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const packages = fs.readdirSync(packageRoot)
99
.map(pkgName => ({ name: pkgName, root: path.join(packageRoot, pkgName) }))
1010
.filter(pkg => fs.statSync(pkg.root).isDirectory())
1111
.reduce((packages, pkg) => {
12-
packages[`@angular-cli/${pkg.name}`] = {
12+
let name = pkg == 'angular-cli' ? 'angular-cli' : `@angular-cli/${pkg.name}`;
13+
packages[name] = {
1314
root: pkg.root,
1415
main: path.resolve(pkg.root, 'src/index.ts')
1516
};

tests/acceptance/dynamic-path-parser.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var expect = require('chai').expect;
44
var path = require('path');
5-
var dynamicPathParser = require('../../addon/ng2/utilities/dynamic-path-parser');
5+
var dynamicPathParser = require('../../packages/angular-cli/utilities/dynamic-path-parser');
66
var mockFs = require('mock-fs');
77

88
var appDir = `src${path.sep}app`;

tests/acceptance/init.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var glob = require('glob');
77
var Blueprint = require('ember-cli/lib/models/blueprint');
88
var path = require('path');
99
var tmp = require('../helpers/tmp');
10-
var root = process.cwd();
10+
var root = path.join(__dirname, '../../packages/angular-cli');
1111
var util = require('util');
1212
var conf = require('ember-cli/tests/helpers/conf');
1313
var minimatch = require('minimatch');
@@ -45,8 +45,8 @@ describe('Acceptance: ng init', function () {
4545
});
4646

4747
function confirmBlueprinted(isMobile) {
48-
var blueprintPath = path.join(root, 'addon', 'ng2', 'blueprints', 'ng2', 'files');
49-
var mobileBlueprintPath = path.join(root, 'addon', 'ng2', 'blueprints', 'mobile', 'files');
48+
var blueprintPath = path.join(root, 'blueprints', 'ng2', 'files');
49+
var mobileBlueprintPath = path.join(root, 'blueprints', 'mobile', 'files');
5050
var expected = unique(walkSync(blueprintPath).concat(isMobile ? walkSync(mobileBlueprintPath) : []).sort());
5151
var actual = walkSync('.').sort();
5252

@@ -76,7 +76,7 @@ describe('Acceptance: ng init', function () {
7676
}
7777

7878
function confirmGlobBlueprinted(pattern) {
79-
var blueprintPath = path.join(root, 'addon', 'ng2', 'blueprints', 'ng2', 'files');
79+
var blueprintPath = path.join(root, 'blueprints', 'ng2', 'files');
8080
var actual = pickSync('.', pattern);
8181
var expected = intersect(pickSync(blueprintPath, pattern), actual);
8282

tests/acceptance/new.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('Acceptance: ng new', function () {
5858
}
5959

6060
function confirmBlueprinted() {
61-
return confirmBlueprintedForDir('addon/ng2/blueprints/ng2');
61+
return confirmBlueprintedForDir('blueprints/ng2');
6262
}
6363

6464
it('ng new foo, where foo does not yet exist, works', function () {

tests/helpers/ng.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var MockUI = require('./mock-ui');
44
var MockAnalytics = require('./mock-analytics');
5-
var Cli = require('../../lib/cli');
5+
var Cli = require('angular-cli/lib/cli');
66

77
module.exports = function ng(args) {
88
var cli;

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929
},
3030
"exclude": [
31-
"addon/ng2/blueprints/*/files/**/*",
31+
"packages/angular-cli/blueprints/*/files/**/*",
3232
"dist/**/*",
3333
"node_modules/**/*",
3434
"tmp/**/*"

0 commit comments

Comments
 (0)