1
- import co from 'co' ;
2
1
import SkeletonApp from '../helpers/skeleton-app' ;
3
2
import chai from 'ember-cli-blueprint-test-helpers/chai' ;
4
3
import * as esprima from 'esprima' ;
@@ -25,90 +24,78 @@ describe('Acceptance: build', function() {
25
24
app . teardown ( ) ;
26
25
} ) ;
27
26
28
- it (
29
- 'builds and rebuilds files' ,
30
- co . wrap ( function * ( ) {
31
- app . writeFile (
32
- 'app/app.ts' ,
33
- `
27
+ it ( 'builds and rebuilds files' , async ( ) => {
28
+ app . writeFile (
29
+ 'app/app.ts' ,
30
+ `
34
31
export function add(a: number, b: number) {
35
32
return a + b;
36
33
}
37
34
`
38
- ) ;
35
+ ) ;
39
36
40
- let server = app . serve ( ) ;
37
+ let server = app . serve ( ) ;
41
38
42
- yield server . waitForBuild ( ) ;
39
+ await server . waitForBuild ( ) ;
43
40
44
- expectModuleBody (
45
- app ,
46
- 'skeleton-app/app' ,
47
- `
41
+ expectModuleBody (
42
+ app ,
43
+ 'skeleton-app/app' ,
44
+ `
48
45
_exports.add = add;
49
46
function add(a, b) {
50
47
return a + b;
51
48
}
52
49
`
53
- ) ;
50
+ ) ;
54
51
55
- app . writeFile (
56
- 'app/app.ts' ,
57
- `
52
+ app . writeFile (
53
+ 'app/app.ts' ,
54
+ `
58
55
export const foo: string = 'hello';
59
56
`
60
- ) ;
57
+ ) ;
61
58
62
- yield server . waitForBuild ( ) ;
59
+ await server . waitForBuild ( ) ;
63
60
64
- expectModuleBody (
65
- app ,
66
- 'skeleton-app/app' ,
67
- `
61
+ expectModuleBody (
62
+ app ,
63
+ 'skeleton-app/app' ,
64
+ `
68
65
_exports.foo = void 0;
69
66
var foo = 'hello';
70
67
_exports.foo = foo;
71
68
`
72
- ) ;
73
- } )
74
- ) ;
69
+ ) ;
70
+ } ) ;
75
71
76
- it (
77
- 'fails the build when noEmitOnError is set and an error is emitted' ,
78
- co . wrap ( function * ( ) {
79
- app . writeFile ( 'app/app.ts' , `import { foo } from 'nonexistent';` ) ;
72
+ it ( 'fails the build when noEmitOnError is set and an error is emitted' , async ( ) => {
73
+ app . writeFile ( 'app/app.ts' , `import { foo } from 'nonexistent';` ) ;
80
74
81
- yield expect ( app . build ( ) ) . to . be . rejectedWith ( `Cannot find module 'nonexistent'` ) ;
82
- } )
83
- ) ;
75
+ await expect ( app . build ( ) ) . to . be . rejectedWith ( `Cannot find module 'nonexistent'` ) ;
76
+ } ) ;
84
77
85
- it (
86
- 'serves a type error page when the build has failed' ,
87
- co . wrap ( function * ( ) {
88
- app . writeFile ( 'app/index.html' , 'plain index' ) ;
89
- app . writeFile ( 'app/app.ts' , `import { foo } from 'nonexistent';` ) ;
78
+ it ( 'serves a type error page when the build has failed' , async ( ) => {
79
+ app . writeFile ( 'app/index.html' , 'plain index' ) ;
80
+ app . writeFile ( 'app/app.ts' , `import { foo } from 'nonexistent';` ) ;
90
81
91
- let server = app . serve ( ) ;
92
- let output = yield server . waitForOutput ( 'Typechecking failed' ) ;
93
- let response = yield server . request ( '/' ) ;
82
+ let server = app . serve ( ) ;
83
+ let output = await server . waitForOutput ( 'Typechecking failed' ) ;
84
+ let response = await server . request ( '/' ) ;
94
85
95
- expect ( output ) . to . include ( `Cannot find module 'nonexistent'` ) ;
96
- expect ( response . body ) . to . include ( `Cannot find module 'nonexistent'` ) ;
97
- } )
98
- ) ;
86
+ expect ( output ) . to . include ( `Cannot find module 'nonexistent'` ) ;
87
+ expect ( response . body ) . to . include ( `Cannot find module 'nonexistent'` ) ;
88
+ } ) ;
99
89
100
- it (
101
- "doesn't block builds for file changes that don't result in a typecheck" ,
102
- co . wrap ( function * ( ) {
103
- let server = app . serve ( ) ;
90
+ it ( "doesn't block builds for file changes that don't result in a typecheck" , async ( ) => {
91
+ let server = app . serve ( ) ;
104
92
105
- yield server . waitForBuild ( ) ;
93
+ await server . waitForBuild ( ) ;
106
94
107
- app . writeFile ( 'app/some-template.hbs' , '' ) ;
95
+ app . writeFile ( 'app/some-template.hbs' , '' ) ;
108
96
109
- yield server . waitForBuild ( ) ;
110
- } )
111
- ) ;
97
+ await server . waitForBuild ( ) ;
98
+ } ) ;
112
99
} ) ;
113
100
114
101
function isExpressionStatement ( stmt : Statement | ModuleDeclaration ) : stmt is ExpressionStatement {
0 commit comments