diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml new file mode 100644 index 0000000..d667bc8 --- /dev/null +++ b/.github/workflows/dart.yml @@ -0,0 +1,36 @@ +name: Dart + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + env: + DISPLAY: ':99' + + steps: + - uses: actions/checkout@v2 + - uses: cedx/setup-dart@v2 + with: + release-channel: stable + version: latest + + - name: Print Dart SDK version + run: dart --version + + - name: Install dependencies + run: dart pub get + + - name: Analyze project source + run: dart analyze + + - name: Run Xvfb + run: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + + - name: Run tests + run: dart test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b4e1991..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: dart - -dart: - - 2.2.0 - - dev - -dart_task: - - test - - dartanalyzer: --fatal-infos --fatal-warnings . - -matrix: - include: - # Only validate formatting using the dev release - - dart: dev - dart_task: dartfmt - -# Only building master means that we don't run two builds for each pull request. -branches: - only: [master] - -cache: - directories: - - $HOME/.pub-cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bfd551..9f9759a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.8 + +- Log `STDERR` on Chrome launch failure. + ## 0.1.7 - Widen the dependency range on `package:webkit_inspection_protocol`. diff --git a/lib/src/chrome.dart b/lib/src/chrome.dart index 2a8b3de..bfa4270 100644 --- a/lib/src/chrome.dart +++ b/lib/src/chrome.dart @@ -95,13 +95,20 @@ class Chrome { final process = await _startProcess(urls, args: args); // Wait until the DevTools are listening before trying to connect. - await process.stderr - .transform(utf8.decoder) - .transform(const LineSplitter()) - .firstWhere((line) => line.startsWith('DevTools listening')) - .timeout(Duration(seconds: 60), - onTimeout: () => - throw Exception('Unable to connect to Chrome DevTools.')); + var _errorLines = []; + try { + await process.stderr + .transform(utf8.decoder) + .transform(const LineSplitter()) + .firstWhere((line) { + _errorLines.add(line); + return line.startsWith('DevTools listening'); + }).timeout(Duration(seconds: 60)); + } catch (_) { + throw Exception('Unable to connect to Chrome DevTools.\n\n' + 'Chrome STDERR:\n' + + _errorLines.join('\n')); + } return _connect(Chrome._( port, diff --git a/pubspec.yaml b/pubspec.yaml index 17b8822..1d8367b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: browser_launcher description: Provides a standardized way to launch web browsers for testing and tools. -version: 0.1.7 +version: 0.1.8 homepage: https://github.com/dart-lang/browser_launcher