Skip to content

Coverage test fails in pub workspace #2844

@ScottMacDougall

Description

@ScottMacDougall

Steps to reproduce

  1. Clone https://github.com/ScottMacDougall/patrol_workspace
  2. Change directory to app2
  3. Run patrol test -t patrol_test/example_test.dart --coverage
  4. Validate that coverage report is generated
  5. Change directory to app
  6. Run patrol test -t patrol_test/example_test.dart --coverage

Actual results

Exception is being thrown because in a workspace repo, .dart_tool is at the root of the repo, not the app directory (See Logs).

Logs

Logs
Unhandled exception:
PathNotFoundException: Cannot open file, path = '{{PROJECT_DIRECTORY}}/app/.dart_tool/package_config.json' (OS Error: No such file or directory, errno = 2)
#0      throwError (package:package_config/src/errors.dart:34:35)
#1      readAnyConfigFile (package:package_config/src/package_config_io.dart:58:12)
<asynchronous suspension>
#2      CoverageTool._getCoveragePackages (package:patrol_cli/src/coverage/coverage_tool.dart:239:27)
<asynchronous suspension>
#3      CoverageTool._collectAndMarkTestCompleted (package:patrol_cli/src/coverage/coverage_tool.dart:198:22)
<asynchronous suspension>
#4      CoverageTool._collectFromVM (package:patrol_cli/src/coverage/coverage_tool.dart:182:7)
<asynchronous suspension>
#5      Stream.asyncMap.<anonymous closure>.add (dart:async/stream.dart:822:7)
<asynchronous suspension>
#6      _BufferingStreamSubscription.resume (dart:async/stream_impl.dart:215:3)

Patrol version

patrol: ^4.0.1

Patrol Doctor output

Patrol Doctor output
Patrol doctor:
Patrol CLI version: 4.0.1
Flutter command: flutter 
  Flutter 3.32.8 • channel stable
Android: 
• Program adb found in /Users/Scott/Library/Android/sdk/platform-tools/adb
• Env var $ANDROID_HOME set to /Users/Scott/Library/Android/sdk
iOS / macOS: 
• Program xcodebuild found in /usr/bin/xcodebuild
• Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller
Web: 
• Program node found in /usr/local/bin/node
• Program npm found in /usr/local/bin/npm

Flutter Doctor output

Flutter Doctor output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: patrolRelated to the patrol package (native automation, test bundling)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions