Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: test/dart2js/environment_constant_test.dart

Issue 1282533003: Don't implicitly run "pub get". (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Dart2js can take a long time to compile dart code, so we increase the timeout 5 // Dart2js can take a long time to compile dart code, so we increase the timeout
6 // to cope with that. 6 // to cope with that.
7 @Timeout.factor(3) 7 @Timeout.factor(3)
8 8
9 import 'package:scheduled_test/scheduled_test.dart'; 9 import 'package:scheduled_test/scheduled_test.dart';
10 10
11 import '../descriptor.dart' as d; 11 import '../descriptor.dart' as d;
12 import '../serve/utils.dart'; 12 import '../serve/utils.dart';
13 import '../test_pub.dart'; 13 import '../test_pub.dart';
14 14
15 main() { 15 main() {
16 group("passes environment constants to dart2js", () { 16 group("passes environment constants to dart2js", () {
17 setUp(() { 17 setUp(() {
18 d.dir(appPath, [ 18 d.dir(appPath, [
19 d.appPubspec(), 19 d.appPubspec(),
20 d.dir('web', [ 20 d.dir('web', [
21 d.file('file.dart', 21 d.file('file.dart',
22 'void main() => print(const String.fromEnvironment("name"));') 22 'void main() => print(const String.fromEnvironment("name"));')
23 ]) 23 ])
24 ]).create(); 24 ]).create();
25 }); 25 });
26 26
27 integration('from "pub build"', () { 27 integration('from "pub build"', () {
28 pubGet();
28 schedulePub(args: ["build", "--define", "name=fblthp"], 29 schedulePub(args: ["build", "--define", "name=fblthp"],
29 output: new RegExp(r'Built 1 file to "build".')); 30 output: new RegExp(r'Built 1 file to "build".'));
30 31
31 d.dir(appPath, [ 32 d.dir(appPath, [
32 d.dir('build', [ 33 d.dir('build', [
33 d.dir('web', [ 34 d.dir('web', [
34 d.matcherFile('file.dart.js', contains('fblthp')), 35 d.matcherFile('file.dart.js', contains('fblthp')),
35 ]) 36 ])
36 ]) 37 ])
37 ]).validate(); 38 ]).validate();
38 }); 39 });
39 40
40 integration('from "pub serve"', () { 41 integration('from "pub serve"', () {
41 pubServe(args: ["--define", "name=fblthp"], shouldGetFirst: true); 42 pubGet();
43 pubServe(args: ["--define", "name=fblthp"]);
42 requestShouldSucceed("file.dart.js", contains("fblthp")); 44 requestShouldSucceed("file.dart.js", contains("fblthp"));
43 endPubServe(); 45 endPubServe();
44 }); 46 });
45 47
46 integration('which takes precedence over the pubspec', () { 48 integration('which takes precedence over the pubspec', () {
47 d.dir(appPath, [ 49 d.dir(appPath, [
48 d.pubspec({ 50 d.pubspec({
49 "name": "myapp", 51 "name": "myapp",
50 "transformers": [ 52 "transformers": [
51 {"\$dart2js": {"environment": {"name": "slartibartfast"}}} 53 {"\$dart2js": {"environment": {"name": "slartibartfast"}}}
52 ] 54 ]
53 }) 55 })
54 ]).create(); 56 ]).create();
55 57
56 pubServe(args: ["--define", "name=fblthp"], shouldGetFirst: true); 58 pubGet();
59 pubServe(args: ["--define", "name=fblthp"]);
57 requestShouldSucceed("file.dart.js", allOf([ 60 requestShouldSucceed("file.dart.js", allOf([
58 contains("fblthp"), 61 contains("fblthp"),
59 isNot(contains("slartibartfast")) 62 isNot(contains("slartibartfast"))
60 ])); 63 ]));
61 endPubServe(); 64 endPubServe();
62 }); 65 });
63 }); 66 });
64 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698