@@ -129,18 +129,7 @@ class TestContext {
129129 /// External VM service.
130130 VmService get vmService => debugConnection.vmService;
131131
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);
144133
145134 Future <void > setUp ({
146135 TestSettings testSettings = const TestSettings (),
@@ -160,10 +149,17 @@ class TestContext {
160149 final sdkLayout = sdkConfigurationProvider.sdkLayout;
161150 final configuration = await sdkConfigurationProvider.configuration;
162151 configuration.validate ();
163- await project.cleanUp ();
152+ await project.setUp ();
164153
165154 DartUri .currentDirectory = project.absolutePackageDirectory;
166155
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+
167163 configureLogWriter ();
168164
169165 _client = IOClient (
@@ -552,6 +548,7 @@ class TestContext {
552548 _client? .close ();
553549 await _outputDir? .delete (recursive: true );
554550 stopLogWriter ();
551+ project.tearDown ();
555552
556553 // clear the state for next setup
557554 _webDriver = null ;
@@ -568,6 +565,10 @@ class TestContext {
568565 required String toReplace,
569566 required String replaceWith,
570567 }) {
568+ assert (
569+ project.editable,
570+ 'Project ${project .packageName } is not marked as editable' ,
571+ );
571572 final file = File (project.dartEntryFilePath);
572573 final fileContents = file.readAsStringSync ();
573574 file.writeAsStringSync (fileContents.replaceAll (toReplace, replaceWith));
@@ -578,23 +579,26 @@ class TestContext {
578579 required String toReplace,
579580 required String replaceWith,
580581 }) {
582+ assert (
583+ project.editable,
584+ 'Project ${project .packageName } is not marked as editable' ,
585+ );
581586 final file = File (project.dartLibFilePath (libFileName));
582587 final fileContents = file.readAsStringSync ();
583588 file.writeAsStringSync (fileContents.replaceAll (toReplace, replaceWith));
584589 }
585590
586591 void addLibraryFile ({required String libFileName, required String contents}) {
592+ assert (
593+ project.editable,
594+ 'Project ${project .packageName } is not marked as editable' ,
595+ );
587596 final file = File (project.dartLibFilePath (libFileName));
588597 // Library folder may not exist yet, so create it.
589598 file.createSync (recursive: true );
590599 file.writeAsStringSync (contents);
591600 }
592601
593- void removeLibraryFile ({required String libFileName}) {
594- final file = File (project.dartLibFilePath (libFileName));
595- file.deleteSync ();
596- }
597-
598602 Future <void > recompile ({required bool fullRestart}) async {
599603 await webRunner.run (
600604 frontendServerFileSystem,
0 commit comments