@@ -10,25 +10,37 @@ import 'package:expect/expect.dart';
10
10
import 'source_map_validator_helper.dart' ;
11
11
12
12
void main () {
13
- asyncTest (() => createTempDir ().then ((Directory tmpDir) {
14
- Directory sunflowerDir = new Directory .fromUri (
15
- Platform .script.resolve ('../../../third_party/sunflower' ));
13
+ asyncTest (() async {
14
+ Directory tmpDir = createTempDir ();
15
+ try {
16
+ Directory sunflowerDir = new Directory .fromUri (
17
+ Platform .script.resolve ('../../../third_party/sunflower' ));
16
18
17
- print ("Copying '${sunflowerDir .path }' to '${tmpDir .path }'." );
18
- copyDirectory (sunflowerDir, tmpDir);
19
- String ext = Platform .isWindows ? '.bat' : '' ;
20
- String command = path.normalize (path.join (path.fromUri (Platform .script),
21
- '../../../../sdk/bin/pub${ext }' ));
22
- String file = path.join (tmpDir.path, 'build/web/sunflower.dart.js' );
23
- print ("Running '$command build --mode=debug' from '${tmpDir }'." );
24
- return Process .run (command, ['build' ,'--mode=debug' ],
25
- workingDirectory: tmpDir.path).then ((ProcessResult processResult) {
26
- print (processResult.stdout);
27
- print (processResult.stderr);
28
- Expect .equals (0 , processResult.exitCode, 'Unexpected exitCode from pub' );
19
+ print ("Copying '${sunflowerDir .path }' to '${tmpDir .path }'." );
20
+ copyDirectory (sunflowerDir, tmpDir);
21
+ String ext = Platform .isWindows ? '.bat' : '' ;
22
+ String command = path.normalize (path.join (
23
+ path.fromUri (Platform .script),
24
+ '../../../../sdk/bin/pub${ext }' ));
25
+ String file = path.join (tmpDir.path, 'build/web/sunflower.dart.js' );
26
+
27
+ print ("Running '$command get' from '${tmpDir }'." );
28
+ ProcessResult getResult = await Process .run (
29
+ command, ['get' ], workingDirectory: tmpDir.path);
30
+ print (getResult.stdout);
31
+ print (getResult.stderr);
32
+ Expect .equals (0 , getResult.exitCode, 'Unexpected exitCode from pub get' );
33
+
34
+ print ("Running '$command build --mode=debug' from '${tmpDir }'." );
35
+ ProcessResult buildResult = await Process .run (
36
+ command, ['build' ,'--mode=debug' ], workingDirectory: tmpDir.path);
37
+ print (buildResult.stdout);
38
+ print (buildResult.stderr);
39
+ Expect .equals (0 , buildResult.exitCode, 'Unexpected exitCode from pub' );
29
40
validateSourceMap (new Uri .file (file, windows: Platform .isWindows));
30
41
print ("Deleting '${tmpDir .path }'." );
42
+ } finally {
31
43
tmpDir.deleteSync (recursive: true );
32
- });
44
+ }
33
45
}));
34
46
}
0 commit comments