diff --git a/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart b/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart index 37e5923dffc..37e5d33a217 100644 --- a/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart +++ b/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart @@ -628,16 +628,16 @@ abstract class ImportAnalyzerTest extends PubPackageAnalysisServerTest { Map<_ExpectedElement, List>? expectedStayingReferences}) async { createDefaultFiles(); var testCode = TestCode.parse(code); - addTestFile(testCode.code); + var pathToInclude = newFile(testFilePath, testCode.code).path; var context = AnalysisContextCollection( - includedPaths: [testFilePath], + includedPaths: [pathToInclude], resourceProvider: resourceProvider, sdkPath: sdkRoot.path) .contexts[0]; - var result = await context.currentSession.getResolvedLibrary(testFilePath) + var result = await context.currentSession.getResolvedLibrary(pathToInclude) as ResolvedLibraryResult; var analyzer = - ImportAnalyzer(result, testFilePath, testCode.range.sourceRange); + ImportAnalyzer(result, pathToInclude, testCode.range.sourceRange); if (expectedMovingDeclarations != null) { var movingDeclarations = analyzer.movingDeclarations.toList();