From 8b83371e207a6f2121ba431542d3a0f48ecfac56 Mon Sep 17 00:00:00 2001 From: Jesse <103135467+sealesj@users.noreply.github.com> Date: Tue, 2 Apr 2024 19:26:51 -0400 Subject: [PATCH] Refactor docs (#145998) Refactor docs testing suite in order to reduce testing logic in test.dart and allow for later implementing package:test onto the existing docs tests Part of https://github.com/flutter/flutter/issues/145482 --- dev/bots/suite_runners/run_docs_tests.dart | 20 ++++++++++++++++++++ dev/bots/test.dart | 19 ++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 dev/bots/suite_runners/run_docs_tests.dart diff --git a/dev/bots/suite_runners/run_docs_tests.dart b/dev/bots/suite_runners/run_docs_tests.dart new file mode 100644 index 0000000000..729ca0b614 --- /dev/null +++ b/dev/bots/suite_runners/run_docs_tests.dart @@ -0,0 +1,20 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import '../run_command.dart'; +import '../utils.dart'; + +Future docsRunner(String flutterRoot) async { + printProgress('${green}Running flutter doc tests$reset'); + await runCommand( + './dev/bots/docs.sh', + const [ + '--output', + 'dev/docs/api_docs.zip', + '--keep-staging', + '--staging-dir', + 'dev/docs', + ], + workingDirectory: flutterRoot, + );} diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 0784317aa7..0b2c1f9321 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -66,6 +66,7 @@ import 'package:process/process.dart'; import 'run_command.dart'; import 'suite_runners/run_add_to_app_life_cycle_tests.dart'; import 'suite_runners/run_analyze_tests.dart'; +import 'suite_runners/run_docs_tests.dart'; import 'suite_runners/run_flutter_packages_tests.dart'; import 'suite_runners/run_realm_checker_tests.dart'; import 'suite_runners/run_skp_generator_tests.dart'; @@ -255,7 +256,7 @@ Future main(List args) async { 'customer_testing': _runCustomerTesting, 'analyze': () => analyzeRunner(flutterRoot), 'fuchsia_precache': _runFuchsiaPrecache, - 'docs': _runDocs, + 'docs': () => docsRunner(flutterRoot), 'verify_binaries_codesigned': _runVerifyCodesigned, kTestHarnessShardName: _runTestHarnessTests, // Used for testing this script; also run as part of SHARD=framework_tests, SUBSHARD=misc. }); @@ -1264,22 +1265,6 @@ Future _runFuchsiaPrecache() async { ); } -// Runs docs. -Future _runDocs() async { - printProgress('${green}Running flutter doc tests$reset'); - await runCommand( - './dev/bots/docs.sh', - [ - '--output', - 'dev/docs/api_docs.zip', - '--keep-staging', - '--staging-dir', - 'dev/docs', - ], - workingDirectory: flutterRoot, - ); -} - // Verifies binaries are codesigned. Future _runVerifyCodesigned() async { printProgress('${green}Running binaries codesign verification$reset');