Fixed regex to show missing assets file error (#131160)
Added Regex to match error message from verbos build as suggested by @stuartmorgan [here](https://github.com/flutter/flutter/pull/98137#discussion_r810559589). Modified Windows Build Test Fixes #97065
This commit is contained in:
parent
3cf206ba2c
commit
efc9e16ea3
@ -190,7 +190,16 @@ Future<void> _runBuild(
|
||||
|
||||
// MSBuild sends all output to stdout, including build errors. This surfaces
|
||||
// known error patterns.
|
||||
final RegExp errorMatcher = RegExp(r':\s*(?:warning|(?:fatal )?error).*?:');
|
||||
final RegExp errorMatcher = RegExp(
|
||||
<String>[
|
||||
// Known error messages
|
||||
r'(:\s*(?:warning|(?:fatal )?error).*?:)',
|
||||
r'Error detected in pubspec\.yaml:',
|
||||
|
||||
// Known secondary error lines for pubspec.yaml
|
||||
r'No file or variants found for asset:',
|
||||
].join('|'),
|
||||
);
|
||||
|
||||
int result;
|
||||
try {
|
||||
|
@ -962,6 +962,41 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
|
||||
// Tests the case where stdout contains the error about pubspec.yaml
|
||||
// And tests the case where stdout contains the error about missing assets
|
||||
testUsingContext('Windows build extracts errors related to pubspec.yaml from stdout', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsCommand command = BuildWindowsCommand(logger: BufferLogger.test())
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
const String stdout = r'''
|
||||
Error detected in pubspec.yaml:
|
||||
No file or variants found for asset: images/a_dot_burr.jpeg.
|
||||
''';
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release',
|
||||
stdout: stdout,
|
||||
),
|
||||
]);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>['windows', '--no-pub']
|
||||
);
|
||||
// Just the warnings and errors should be surfaced.
|
||||
expect(testLogger.errorText, r'''
|
||||
Error detected in pubspec.yaml:
|
||||
No file or variants found for asset: images/a_dot_burr.jpeg.
|
||||
''');
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||
});
|
||||
}
|
||||
|
||||
class FakeVisualStudio extends Fake implements VisualStudio {
|
||||
|
Loading…
x
Reference in New Issue
Block a user