From 1266870df7005e3fdbdb9f2b19aef0bde4ee17f0 Mon Sep 17 00:00:00 2001 From: Gary Roumanis <groumanis@gmail.com> Date: Tue, 21 Jan 2020 15:51:03 -0800 Subject: [PATCH] Deprecate PhantomJS (#1149) --- .travis.yml | 10 ++++---- pkgs/test/CHANGELOG.md | 2 ++ pkgs/test/mono_pkg.yaml | 10 ++++---- pkgs/test_core/CHANGELOG.md | 2 ++ .../lib/src/runner/configuration/args.dart | 25 ++++++++++++++----- tool/travis.sh | 20 +++++++-------- 6 files changed, 43 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index e47a4869..2880345d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,31 +25,31 @@ jobs: env: PKGS="pkgs/test pkgs/test_api pkgs/test_core" script: ./tool/travis.sh dartfmt dartanalyzer_0 - stage: unit_test - name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis --total-shards 5 --shard-index 0`" + name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 0`" dart: dev os: linux env: PKGS="pkgs/test" script: ./tool/travis.sh command_0 - stage: unit_test - name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis --total-shards 5 --shard-index 1`" + name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 1`" dart: dev os: linux env: PKGS="pkgs/test" script: ./tool/travis.sh command_1 - stage: unit_test - name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis --total-shards 5 --shard-index 2`" + name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 2`" dart: dev os: linux env: PKGS="pkgs/test" script: ./tool/travis.sh command_2 - stage: unit_test - name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis --total-shards 5 --shard-index 3`" + name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 3`" dart: dev os: linux env: PKGS="pkgs/test" script: ./tool/travis.sh command_3 - stage: unit_test - name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis --total-shards 5 --shard-index 4`" + name: "SDK: dev; PKG: pkgs/test; TASKS: `xvfb-run -s \"-screen 0 1024x768x24\" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 4`" dart: dev os: linux env: PKGS="pkgs/test" diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md index 71b5c965..f493135b 100644 --- a/pkgs/test/CHANGELOG.md +++ b/pkgs/test/CHANGELOG.md @@ -1,6 +1,8 @@ ## 1.11.2-dev * Bump minimum SDK to `2.4.0` for safer usage of for-loop elements. +* Deprecate `PhantomJS` and provide warning when used. Support for `PhantomJS` + will be removed in version `2.0.0`. ## 1.11.1 diff --git a/pkgs/test/mono_pkg.yaml b/pkgs/test/mono_pkg.yaml index 1a84bfae..18489032 100644 --- a/pkgs/test/mono_pkg.yaml +++ b/pkgs/test/mono_pkg.yaml @@ -11,8 +11,8 @@ stages: - dartanalyzer: --fatal-warnings . dart: 2.4.0 - unit_test: - - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 0 - - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 1 - - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 2 - - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 3 - - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 4 + - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 0 + - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 1 + - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 2 + - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 3 + - command: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 4 diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md index 91aa019e..e43f0ab5 100644 --- a/pkgs/test_core/CHANGELOG.md +++ b/pkgs/test_core/CHANGELOG.md @@ -1,6 +1,8 @@ ## 0.2.19-dev * Bump minimum SDK to `2.4.0` for safer usage of for-loop elements. +* Deprecate `PhantomJS` and provide warning when used. Support for `PhantomJS` + will be removed in version `2.0.0`. ## 0.2.18 diff --git a/pkgs/test_core/lib/src/runner/configuration/args.dart b/pkgs/test_core/lib/src/runner/configuration/args.dart index a5afb825..ed7dd263 100644 --- a/pkgs/test_core/lib/src/runner/configuration/args.dart +++ b/pkgs/test_core/lib/src/runner/configuration/args.dart @@ -7,11 +7,12 @@ import 'dart:math'; import 'package:args/args.dart'; import 'package:boolean_selector/boolean_selector.dart'; - import 'package:test_api/src/backend/runtime.dart'; // ignore: implementation_imports import 'package:test_api/src/frontend/timeout.dart'; // ignore: implementation_imports -import '../runtime_selection.dart'; + +import '../../util/io.dart'; import '../configuration.dart'; +import '../runtime_selection.dart'; import 'reporters.dart'; import 'values.dart'; @@ -225,6 +226,20 @@ class _Parser { return seed; }); + var color = _ifParsed<bool>('color') ?? canUseSpecialChars; + + var platform = _ifParsed<List<String>>('platform') + ?.map((runtime) => RuntimeSelection(runtime)) + ?.toList(); + if (platform + ?.any((runtime) => runtime.name == Runtime.phantomJS.identifier) ?? + false) { + var yellow = color ? '\u001b[33m' : ''; + var noColor = color ? '\u001b[0m' : ''; + print('${yellow}Warning:$noColor ' + 'PhatomJS is deprecated and will be removed in version ^2.0.0'); + } + return Configuration( help: _ifParsed('help'), version: _ifParsed('version'), @@ -233,7 +248,7 @@ class _Parser { jsTrace: _ifParsed('js-trace'), pauseAfterLoad: _ifParsed('pause-after-load'), debug: _ifParsed('debug'), - color: _ifParsed('color'), + color: color, configurationPath: _ifParsed('configuration'), dart2jsPath: _ifParsed('dart2js-path'), dart2jsArgs: _ifParsed('dart2js-args'), @@ -247,9 +262,7 @@ class _Parser { totalShards: totalShards, timeout: _parseOption('timeout', (value) => Timeout.parse(value)), patterns: patterns, - runtimes: _ifParsed<List<String>>('platform') - ?.map((runtime) => RuntimeSelection(runtime)) - ?.toList(), + runtimes: platform, runSkipped: _ifParsed('run-skipped'), chosenPresets: _ifParsed('preset'), paths: _options.rest.isEmpty ? null : _options.rest, diff --git a/tool/travis.sh b/tool/travis.sh index 51fad7ca..7ac5921a 100755 --- a/tool/travis.sh +++ b/tool/travis.sh @@ -55,24 +55,24 @@ for PKG in ${PKGS}; do echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m" case ${TASK} in command_0) - echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 0' - xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 0 || EXIT_CODE=$? + echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 0' + xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 0 || EXIT_CODE=$? ;; command_1) - echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 1' - xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 1 || EXIT_CODE=$? + echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 1' + xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 1 || EXIT_CODE=$? ;; command_2) - echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 2' - xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 2 || EXIT_CODE=$? + echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 2' + xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 2 || EXIT_CODE=$? ;; command_3) - echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 3' - xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 3 || EXIT_CODE=$? + echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 3' + xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 3 || EXIT_CODE=$? ;; command_4) - echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 4' - xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 4 || EXIT_CODE=$? + echo 'xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 4' + xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis -x phantomjs --total-shards 5 --shard-index 4 || EXIT_CODE=$? ;; dartanalyzer_0) echo 'dartanalyzer --fatal-infos --fatal-warnings .' -- GitLab