@@ -58,17 +58,7 @@ A dependency on `build_runner` was not found.'''));
58
58
name: sample
59
59
''' ).create ();
60
60
61
- await d.file ('pubspec.lock' , '''
62
- # Copy-pasted from a valid run
63
- packages:
64
- build_runner:
65
- dependency: "direct main"
66
- description:
67
- name: build_runner
68
- url: "https://pub.dartlang.org"
69
- source: hosted
70
- version: "$version "
71
- ''' ).create ();
61
+ await d.file ('pubspec.lock' , _pubspecLock (version: version)).create ();
72
62
73
63
await d.file ('.packages' , '''
74
64
''' ).create ();
@@ -116,17 +106,7 @@ name: sample
116
106
name: sample
117
107
''' ).create ();
118
108
119
- await d.file ('pubspec.lock' , '''
120
- # Copy-pasted from a valid run
121
- packages:
122
- build_runner:
123
- dependency: "direct main"
124
- description:
125
- name: build_runner
126
- url: "https://pub.dartlang.org"
127
- source: hosted
128
- version: "0.8.0"
129
- ''' ).create ();
109
+ await d.file ('pubspec.lock' , _pubspecLock ()).create ();
130
110
131
111
var process = await _runWebDev (['build' ], workingDirectory: d.sandbox);
132
112
@@ -143,17 +123,7 @@ packages:
143
123
name: sample
144
124
''' ).create ();
145
125
146
- await d.file ('pubspec.lock' , '''
147
- # Copy-pasted from a valid run
148
- packages:
149
- build_runner:
150
- dependency: "direct main"
151
- description:
152
- name: build_runner
153
- url: "https://pub.dartlang.org"
154
- source: hosted
155
- version: "0.8.0"
156
- ''' ).create ();
126
+ await d.file ('pubspec.lock' , _pubspecLock ()).create ();
157
127
158
128
await d.file ('.packages' , '' ).create ();
159
129
@@ -169,17 +139,7 @@ packages:
169
139
});
170
140
171
141
test ('should fail if there has been a dependency change' , () async {
172
- await d.file ('pubspec.lock' , '''
173
- # Copy-pasted from a valid run
174
- packages:
175
- build_runner:
176
- dependency: "direct main"
177
- description:
178
- name: build_runner
179
- url: "https://pub.dartlang.org"
180
- source: hosted
181
- version: "0.8.0"
182
- ''' ).create ();
142
+ await d.file ('pubspec.lock' , _pubspecLock ()).create ();
183
143
184
144
await d.file ('.packages' , '' ).create ();
185
145
@@ -228,6 +188,18 @@ dependencies:
228
188
}, timeout: const Timeout (const Duration (minutes: 5 )));
229
189
}
230
190
191
+ String _pubspecLock ({String version: '0.8.0' }) => '''
192
+ # Copy-pasted from a valid run
193
+ packages:
194
+ build_runner:
195
+ dependency: "direct main"
196
+ description:
197
+ name: build_runner
198
+ url: "https://pub.dartlang.org"
199
+ source: hosted
200
+ version: "$version "
201
+ ''' ;
202
+
231
203
/// Returns an environment map that includes `PUB_ENVIRONMENT` .
232
204
///
233
205
/// Maintains any existing values for this environment var.
0 commit comments