@@ -129,18 +129,7 @@ class TestContext {
129
129
/// External VM service.
130
130
VmService get vmService => debugConnection.vmService;
131
131
132
- TestContext (this .project, this .sdkConfigurationProvider) {
133
- DartUri .currentDirectory = project.absolutePackageDirectory;
134
-
135
- project.validate ();
136
-
137
- _logger.info (
138
- 'Serving: ${project .directoryToServe }/${project .filePathToServe }' ,
139
- );
140
- _logger.info ('Project: ${project .absolutePackageDirectory }' );
141
- _logger.info ('Packages: ${project .packageConfigFile }' );
142
- _logger.info ('Entry: ${project .dartEntryFilePath }' );
143
- }
132
+ TestContext (this .project, this .sdkConfigurationProvider);
144
133
145
134
Future <void > setUp ({
146
135
TestSettings testSettings = const TestSettings (),
@@ -160,10 +149,17 @@ class TestContext {
160
149
final sdkLayout = sdkConfigurationProvider.sdkLayout;
161
150
final configuration = await sdkConfigurationProvider.configuration;
162
151
configuration.validate ();
163
- await project.cleanUp ();
152
+ await project.setUp ();
164
153
165
154
DartUri .currentDirectory = project.absolutePackageDirectory;
166
155
156
+ _logger.info (
157
+ 'Serving: ${project .directoryToServe }/${project .filePathToServe }' ,
158
+ );
159
+ _logger.info ('Project: ${project .absolutePackageDirectory }' );
160
+ _logger.info ('Packages: ${project .packageConfigFile }' );
161
+ _logger.info ('Entry: ${project .dartEntryFilePath }' );
162
+
167
163
configureLogWriter ();
168
164
169
165
_client = IOClient (
@@ -552,6 +548,7 @@ class TestContext {
552
548
_client? .close ();
553
549
await _outputDir? .delete (recursive: true );
554
550
stopLogWriter ();
551
+ project.tearDown ();
555
552
556
553
// clear the state for next setup
557
554
_webDriver = null ;
@@ -568,6 +565,10 @@ class TestContext {
568
565
required String toReplace,
569
566
required String replaceWith,
570
567
}) {
568
+ assert (
569
+ project.editable,
570
+ 'Project ${project .packageName } is not marked as editable' ,
571
+ );
571
572
final file = File (project.dartEntryFilePath);
572
573
final fileContents = file.readAsStringSync ();
573
574
file.writeAsStringSync (fileContents.replaceAll (toReplace, replaceWith));
@@ -578,23 +579,26 @@ class TestContext {
578
579
required String toReplace,
579
580
required String replaceWith,
580
581
}) {
582
+ assert (
583
+ project.editable,
584
+ 'Project ${project .packageName } is not marked as editable' ,
585
+ );
581
586
final file = File (project.dartLibFilePath (libFileName));
582
587
final fileContents = file.readAsStringSync ();
583
588
file.writeAsStringSync (fileContents.replaceAll (toReplace, replaceWith));
584
589
}
585
590
586
591
void addLibraryFile ({required String libFileName, required String contents}) {
592
+ assert (
593
+ project.editable,
594
+ 'Project ${project .packageName } is not marked as editable' ,
595
+ );
587
596
final file = File (project.dartLibFilePath (libFileName));
588
597
// Library folder may not exist yet, so create it.
589
598
file.createSync (recursive: true );
590
599
file.writeAsStringSync (contents);
591
600
}
592
601
593
- void removeLibraryFile ({required String libFileName}) {
594
- final file = File (project.dartLibFilePath (libFileName));
595
- file.deleteSync ();
596
- }
597
-
598
602
Future <void > recompile ({required bool fullRestart}) async {
599
603
await webRunner.run (
600
604
frontendServerFileSystem,
0 commit comments