Skip to content

Commit

Permalink
test(@ngtools/webpack): move server stuff to normal test app
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed May 4, 2017
1 parent dfb5859 commit 1ac4d48
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 219 deletions.
5 changes: 5 additions & 0 deletions tests/e2e/assets/webpack/test-app/app/main.server.aot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'core-js/es7/reflect';
import {platformServer} from '@angular/platform-server';
import {ServerAppModuleNgFactory} from './ngfactory/app/server-app.module.ngfactory';

platformServer().bootstrapModuleFactory(ServerAppModuleNgFactory);
5 changes: 5 additions & 0 deletions tests/e2e/assets/webpack/test-app/app/main.server.jit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'core-js/es7/reflect';
import {platformDynamicServer} from '@angular/platform-server';
import {ServerAppModule} from './server-app.module';

platformDynamicServer().bootstrapModule(ServerAppModule);
13 changes: 13 additions & 0 deletions tests/e2e/assets/webpack/test-app/app/server-app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule, Component } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';

@NgModule({
imports: [
AppModule,
ServerModule
],
bootstrap: [AppComponent]
})
export class ServerAppModule { }
27 changes: 14 additions & 13 deletions tests/e2e/assets/webpack/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
"name": "test",
"license": "MIT",
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/compiler-cli": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/platform-server": "^2.3.1",
"@angular/router": "^3.3.1",
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/platform-server": "^4.0.0",
"@angular/router": "^4.0.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"zone.js": "^0.7.2"
"rxjs": "^5.3.0",
"zone.js": "^0.8.9"
},
"devDependencies": {
"node-sass": "^3.7.0",
"performance-now": "^0.2.0",
"raw-loader": "^0.5.1",
"sass-loader": "^3.2.0",
"typescript": "~2.0.3",
"webpack": "2.2.0"
"typescript": "^2.3.2",
"webpack": "2.2.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ module.exports = {
resolve: {
extensions: ['.ts', '.js']
},
target: 'web',
entry: './app/main.ts',
entry: './app/main.server.aot.ts',
output: {
path: './dist',
publicPath: 'dist/',
filename: 'app.main.js'
filename: 'app.server.main.js'
},
plugins: [
new ngToolsWebpack.AotPlugin({
Expand All @@ -23,8 +22,5 @@ module.exports = {
{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.ts$/, loader: '@ngtools/webpack' }
]
},
devServer: {
historyApiFallback: true
}
};

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions tests/e2e/assets/webpack/test-server-app/app/app.component.ts

This file was deleted.

27 changes: 0 additions & 27 deletions tests/e2e/assets/webpack/test-server-app/app/app.module.ts

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions tests/e2e/assets/webpack/test-server-app/app/injectable.ts

This file was deleted.

26 changes: 0 additions & 26 deletions tests/e2e/assets/webpack/test-server-app/app/lazy.module.ts

This file was deleted.

5 changes: 0 additions & 5 deletions tests/e2e/assets/webpack/test-server-app/app/main.ts

This file was deleted.

12 changes: 0 additions & 12 deletions tests/e2e/assets/webpack/test-server-app/index.html

This file was deleted.

27 changes: 0 additions & 27 deletions tests/e2e/assets/webpack/test-server-app/package.json

This file was deleted.

24 changes: 0 additions & 24 deletions tests/e2e/assets/webpack/test-server-app/tsconfig.json

This file was deleted.

12 changes: 7 additions & 5 deletions tests/e2e/tests/packages/webpack/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import {expectFileToMatch} from '../../../utils/fs';

export default function(skipCleaning: () => void) {
return Promise.resolve()
.then(() => createProjectFromAsset('webpack/test-server-app'))
.then(() => exec(normalize('node_modules/.bin/webpack')))
.then(() => expectFileToMatch('dist/app.main.js',
.then(() => createProjectFromAsset('webpack/test-app'))
.then(() => exec(normalize('node_modules/.bin/webpack'),
'--config',
'webpack.server.config.js'))
.then(() => expectFileToMatch('dist/app.server.main.js',
new RegExp('.bootstrapModuleFactory'))
.then(() => expectFileToMatch('dist/app.main.js',
.then(() => expectFileToMatch('dist/app.server.main.js',
new RegExp('MyInjectable.ctorParameters = .*'
+ 'type: .*ViewContainerRef.*'
+ 'type: undefined, decorators.*Inject.*args: .*DOCUMENT.*'))
.then(() => expectFileToMatch('dist/app.main.js',
.then(() => expectFileToMatch('dist/app.server.main.js',
new RegExp('AppComponent.ctorParameters = .*MyInjectable'))
.then(() => skipCleaning());
}

0 comments on commit 1ac4d48

Please sign in to comment.