Skip to content

Commit

Permalink
test: re-enable the app-shell test
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva authored and hansl committed Mar 27, 2018
1 parent 7e09cca commit 3afe1df
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 83 deletions.
50 changes: 25 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

108 changes: 51 additions & 57 deletions tests/e2e/tests/build/build-app-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,58 @@ export default function () {
}

return Promise.resolve()
.then(() => updateJsonFile('angular.json', configJson => {
const app = configJson['apps'][0];
app['appShell'] = {
app: '1',
route: 'shell'
.then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect['server'] = {
builder: '@angular-devkit/build-webpack:server',
options: {
outputPath: 'dist/test-project-server',
main: 'projects/test-project/src/main.server.ts',
tsConfig: 'projects/test-project/tsconfig.server.json'
}
};
configJson['apps'].push({
platform: 'server',
root: 'src',
outDir: 'dist-server',
assets: [
'assets',
'favicon.ico'
],
index: 'index.html',
main: 'main.server.ts',
test: 'test.ts',
tsconfig: 'tsconfig.server.json',
testTsconfig: 'tsconfig.spec.json',
prefix: 'app',
styles: [
'styles.css'
],
scripts: [],
environmentSource: 'environments/environment.ts',
environments: {
dev: 'environments/environment.ts',
prod: 'environments/environment.prod.ts'
appArchitect['app-shell'] = {
builder: '@angular-devkit/build-webpack:app-shell',
options: {
browserTarget: 'test-project:build:production',
serverTarget: 'test-project:server',
route: '/shell'
}
});
};
}))
.then(() => writeFile('./projects/test-project/tsconfig.server.json', `
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../dist-server",
"baseUrl": "./",
"module": "commonjs",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
"angularCompilerOptions": {
"entryModule": "src/app/app.server.module#AppServerModule"
}
}
`))
.then(() => writeFile('./projects/test-project/src/main.server.ts', `
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
export { AppServerModule } from './app/app.server.module';
`))
.then(() => writeFile('projects/test-project/src/app/app.component.html', stripIndent`
Hello World
<router-outlet></router-outlet>
`))
.then(() => writeFile('projects/test-project/src/app/app.module.ts', stripIndent`
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
Expand All @@ -73,31 +94,6 @@ export default function () {
})
export class AppModule { }
`))
.then(() => writeFile('projects/test-project/src/app/app.component.html', stripIndent`
Hello World
<router-outlet></router-outlet>
`))
.then(() => writeFile('projects/test-project/src/tsconfig.server.json', stripIndent`
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "commonjs",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
"angularCompilerOptions": {
"entryModule": "app/app.server.module#AppServerModule"
}
}
`))
.then(() => writeFile('projects/test-project/src/main.server.ts', stripIndent`
export {AppServerModule} from './app/app.server.module';
`))
.then(() => writeFile('projects/test-project/src/app/app.server.module.ts', stripIndent`
import {NgModule} from '@angular/core';
import {ServerModule} from '@angular/platform-server';
Expand Down Expand Up @@ -140,8 +136,6 @@ export default function () {
dependencies['@angular/platform-server'] = platformServerVersion;
})
.then(() => npm('install')))
.then(() => ng('build', '--optimization'))
.then(() => expectFileToMatch('dist/test-project/index.html', /shell Works!/))
.then(() => ng('build', '--optimization', '--skip-app-shell'))
.then(() => expectToFail(() => expectFileToMatch('dist/test-project/index.html', /shell Works!/)));
.then(() => ng('run', 'test-project:app-shell'))
.then(() => expectFileToMatch('dist/test-project/index.html', /shell Works!/));
}
1 change: 0 additions & 1 deletion tests/e2e_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ const allTests = glob.sync(path.join(e2eRoot, testGlob), { nodir: true, ignore:
// Replace windows slashes.
.map(name => name.replace(/\\/g, '/'))
.filter(name => !name.endsWith('/build-app-shell-with-schematic.ts'))
.filter(name => !name.endsWith('/build-app-shell.ts'))
.filter(name => !name.endsWith('/bundle-budgets.ts'))
.filter(name => !name.endsWith('/service-worker.ts'))
.filter(name => !name.endsWith('/new-minimal.ts'))
Expand Down

0 comments on commit 3afe1df

Please sign in to comment.