@@ -12,8 +12,9 @@ import * as path from 'path';
12
12
import { WorkspaceNodeModulesArchitectHost } from '../../../architect/node' ;
13
13
import { Architect } from '../../../architect/src/architect' ;
14
14
import { TestingArchitectHost } from '../../../architect/testing/testing-architect-host' ;
15
+ import { BuildResult } from './index2' ;
15
16
16
- const devkitRoot = normalize ( ( global as any ) . _DevKitRoot ) ; // tslint:disable-line:no-any
17
+ const devkitRoot = ( global as any ) . _DevKitRoot ; // tslint:disable-line:no-any
17
18
18
19
19
20
describe ( 'Webpack Builder basic test' , ( ) => {
@@ -38,8 +39,8 @@ describe('Webpack Builder basic test', () => {
38
39
}
39
40
40
41
describe ( 'basic app' , ( ) => {
41
- const workspaceRoot = join ( devkitRoot , 'tests/angular_devkit/build_webpack/basic-app/' ) ;
42
- const outputPath = join ( workspaceRoot , 'dist' ) ;
42
+ const workspaceRoot = path . join ( devkitRoot , 'tests/angular_devkit/build_webpack/basic-app/' ) ;
43
+ const outputPath = join ( normalize ( workspaceRoot ) , 'dist' ) ;
43
44
44
45
beforeEach ( async ( ) => {
45
46
await createArchitect ( workspaceRoot ) ;
@@ -53,11 +54,26 @@ describe('Webpack Builder basic test', () => {
53
54
expect ( await vfHost . exists ( join ( outputPath , 'bundle.js' ) ) . toPromise ( ) ) . toBe ( true ) ;
54
55
await run . stop ( ) ;
55
56
} ) ;
57
+
58
+ it ( 'works and returns emitted files' , async ( ) => {
59
+ const run = await architect . scheduleTarget ( { project : 'app' , target : 'build' } ) ;
60
+ const output = await run . result as BuildResult ;
61
+
62
+ expect ( output . success ) . toBe ( true ) ;
63
+ expect ( output . emittedFiles ) . toContain ( {
64
+ name : 'main' ,
65
+ initial : true ,
66
+ file : 'bundle.js' ,
67
+ extension : 'js' ,
68
+ } ) ;
69
+
70
+ await run . stop ( ) ;
71
+ } ) ;
56
72
} ) ;
57
73
58
74
describe ( 'Angular app' , ( ) => {
59
- const workspaceRoot = join ( devkitRoot , 'tests/angular_devkit/build_webpack/angular-app/' ) ;
60
- const outputPath = join ( workspaceRoot , 'dist/' ) ;
75
+ const workspaceRoot = path . join ( devkitRoot , 'tests/angular_devkit/build_webpack/angular-app/' ) ;
76
+ const outputPath = join ( normalize ( workspaceRoot ) , 'dist/' ) ;
61
77
62
78
beforeEach ( async ( ) => {
63
79
await createArchitect ( workspaceRoot ) ;
@@ -72,5 +88,18 @@ describe('Webpack Builder basic test', () => {
72
88
expect ( await vfHost . exists ( join ( outputPath , 'polyfills.js' ) ) . toPromise ( ) ) . toBe ( true ) ;
73
89
await run . stop ( ) ;
74
90
} ) ;
91
+
92
+ it ( 'works and returns emitted files' , async ( ) => {
93
+ const run = await architect . scheduleTarget ( { project : 'app' , target : 'build-webpack' } ) ;
94
+ const output = await run . result as BuildResult ;
95
+
96
+ expect ( output . success ) . toBe ( true ) ;
97
+ expect ( output . emittedFiles ) . toContain (
98
+ { name : 'main' , initial : true , file : 'main.js' , extension : 'js' } ,
99
+ { name : 'polyfills' , initial : true , file : 'polyfills.js' , extension : 'js' } ,
100
+ ) ;
101
+
102
+ await run . stop ( ) ;
103
+ } ) ;
75
104
} ) ;
76
105
} ) ;
0 commit comments