Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit d1c3c9c

Browse files
committed
docs(toh-6-aot): make aot e2e tests run in the same project
Updates tooling for this purpose and also the prose.
1 parent 7c2ef49 commit d1c3c9c

File tree

10 files changed

+104
-316
lines changed

10 files changed

+104
-316
lines changed

gulpfile.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,12 @@ function runE2eTsTests(appDir, outputFile) {
296296
var appBuildSpawnInfo = spawnExt('npm', ['run', config.build], { cwd: appDir });
297297
var appRunSpawnInfo = spawnExt('npm', ['run', config.run, '--', '-s'], { cwd: appDir });
298298

299-
return runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile);
299+
var run = runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile);
300+
301+
if (fs.existsSync(appDir + '/aot/index.html')) {
302+
run = run.then(() => runProtractorAoT(appDir, outputFile));
303+
}
304+
return run;
300305
}
301306

302307
function runProtractor(prepPromise, appDir, appRunSpawnInfo, outputFile) {
@@ -341,6 +346,20 @@ function runProtractor(prepPromise, appDir, appRunSpawnInfo, outputFile) {
341346
}
342347
}
343348

349+
function runProtractorAoT(appDir, outputFile) {
350+
fs.appendFileSync(outputFile, '++ AoT version ++\n');
351+
var aotBuildSpawnInfo = spawnExt('npm', ['run', 'build:aot'], { cwd: appDir });
352+
var promise = aotBuildSpawnInfo.promise;
353+
354+
var copyFileCmd = 'copy-dist-files.js';
355+
if (fs.existsSync(appDir + '/' + copyFileCmd)) {
356+
promise = promise.then(() =>
357+
spawnExt('node', [copyFileCmd], { cwd: appDir }).promise );
358+
}
359+
var aotRunSpawnInfo = spawnExt('npm', ['run', 'http-server:e2e', 'aot', '--', '-s'], { cwd: appDir });
360+
return runProtractor(promise, appDir, aotRunSpawnInfo, outputFile);
361+
}
362+
344363
// start the server in appDir/build/web; then run protractor with the specified
345364
// fileName; then shut down the example. All protractor output is appended
346365
// to the outputFile.
@@ -883,7 +902,7 @@ function harpCompile() {
883902
gutil.log("NODE_ENV: " + process.env.NODE_ENV);
884903

885904
if(argv.page) harpJsonSetJade2NgTo(true);
886-
905+
887906
if(skipLangs && fs.existsSync(WWW) && backupApiHtmlFilesExist(WWW)) {
888907
gutil.log(`Harp site recompile: skipping recompilation of API docs for [${skipLangs}]`);
889908
gutil.log(`API docs will be copied from existing ${WWW} folder.`)

public/docs/_examples/_boilerplate/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"http-server:e2e": "http-server",
1010
"http-server:cli": "http-server dist/",
1111
"lite": "lite-server",
12+
"lite:aot": "lite-server -c aot/bs-config.json",
1213
"postinstall": "typings install",
1314
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
1415
"tsc": "tsc",
@@ -18,7 +19,7 @@
1819
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
1920
"build:cli": "ng build",
2021
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js",
21-
"build:toh-aot": "ngc -p ../../toh-6/ts/tsconfig-aot.json && rollup -c ../../toh-6/ts/rollup-config.js",
22+
"copy-dist-files": "node ./copy-dist-files.js",
2223
"i18n": "ng-xi18n"
2324
},
2425
"keywords": [],

public/docs/_examples/toh-6-aot/e2e-spec.ts

Lines changed: 0 additions & 283 deletions
This file was deleted.

public/docs/_examples/toh-6-aot/ts/example-config.json

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
**/*.js
2-
aot
3-
**/*.ngfactory.ts
2+
aot/**/*.ts
43
!rollup-config.js
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"port": 8000,
3+
"files": ["./aot/**/*.{html,htm,css,js}"],
4+
"server": { "baseDir": "./aot" }
5+
}

public/docs/_examples/toh-6-aot/ts/index.html renamed to public/docs/_examples/toh-6/ts/aot/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
<base href="/">
66
<title>Angular Tour of Heroes</title>
77
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
<link rel="stylesheet" href="styles.css">
98

10-
<script src="node_modules/core-js/client/shim.min.js"></script>
11-
<script src="node_modules/zone.js/dist/zone.js"></script>
9+
<script src="shim.min.js"></script>
10+
<script src="zone.min.js"></script>
1211
<!-- #docregion moduleId -->
1312
<script>window.module = 'aot';</script>
1413
<!-- #enddocregion moduleId -->
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// #docregion
2+
var fs = require('fs');
3+
var resources = [
4+
'node_modules/core-js/client/shim.min.js',
5+
'node_modules/zone.js/dist/zone.min.js'
6+
];
7+
resources.map(function(f) {
8+
var path = f.split('/');
9+
var t = 'aot/' + path[path.length-1];
10+
fs.createReadStream(f).pipe(fs.createWriteStream(t));
11+
});

0 commit comments

Comments
 (0)