Skip to content

Commit 57bf18c

Browse files
committed
Fix dart2js/source_map_pub_build_validity_test.
This relied on "pub build" implicitly running "pub get", which it no longer does. Fixes #24102 [email protected] Review URL: https://codereview.chromium.org//1295653005 .
1 parent 6c7093d commit 57bf18c

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

tests/compiler/dart2js/source_map_pub_build_validity_test.dart

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,37 @@ import 'package:expect/expect.dart';
1010
import 'source_map_validator_helper.dart';
1111

1212
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'));
1618

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');
2940
validateSourceMap(new Uri.file(file, windows: Platform.isWindows));
3041
print("Deleting '${tmpDir.path}'.");
42+
} finally {
3143
tmpDir.deleteSync(recursive: true);
32-
});
44+
}
3345
}));
3446
}

0 commit comments

Comments
 (0)