Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion lib/web_ui/dev/test_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ class TestCommand extends Command<bool> {

_copyTestFontsIntoWebUi();
await _buildHostPage();
if (io.Platform.isWindows) {
// On Dart 2.7 or greater, it gives an error for not
// recognized "pub" version and asks for "pub" get.
// See: https://github.com/dart-lang/sdk/issues/39738
await _runPubGet();
}

final List<FilePath> targets =
this.targets.map((t) => FilePath.fromCwd(t)).toList();
Expand Down Expand Up @@ -162,7 +168,9 @@ class TestCommand extends Command<bool> {
// Not a test file at all. Skip.
continue;
}
if(!path.split(testFilePath.relativeToWebUi).contains('golden_tests')) {
if (!path
.split(testFilePath.relativeToWebUi)
.contains('golden_tests')) {
unitTestFiles.add(testFilePath);
}
}
Expand All @@ -179,6 +187,22 @@ class TestCommand extends Command<bool> {
}
}

Future<void> _runPubGet() async {
final int exitCode = await runProcess(
environment.pubExecutable,
<String>[
'get',
],
workingDirectory: environment.webUiRootDir.path,
);

if (exitCode != 0) {
io.stderr
.writeln('Failed to run pub get. Exited with exit code $exitCode');
io.exit(1);
}
}

Future<void> _buildHostPage() async {
final String hostDartPath = path.join('lib', 'static', 'host.dart');
final io.File hostDartFile = io.File(path.join(
Expand Down
3 changes: 3 additions & 0 deletions lib/web_ui/dev/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Future<int> runProcess(
executable,
arguments,
workingDirectory: workingDirectory,
// Running the process in a system shell for Windows. Otherwise
// the process is not able to get Dart from path.
runInShell: io.Platform.isWindows,
mode: io.ProcessStartMode.inheritStdio,
);
final int exitCode = await process.exitCode;
Expand Down