Skip to content

Commit

Permalink
Merge pull request #18 from Workiva/dart2
Browse files Browse the repository at this point in the history
AF-1874 Dart 2 compatibility
  • Loading branch information
rm-astro-wf authored Jul 31, 2018
2 parents ea343e8 + 558fa6c commit fec89b1
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: dart

dart:
- stable
- 1.24.3
- dev

# Workaround for issue with sandboxed Chrome in containerized Travis builds.
Expand All @@ -16,5 +16,5 @@ cache:

before_script: npm install
script:
- pub run dart_dev analyze
- dartanalyzer .
- ./tool/travis.sh test
47 changes: 47 additions & 0 deletions dart_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Dart 1:
# -------
#
# Run unit tests:
#
# $ pub run test
#
# Run integration tests:
#
# $ node tool/server.js
# $ pub run test -P integration
#
#
# Dart 2:
# -------
#
# Run unit tests:
#
# $ pub run build_runner test
#
# Run integration tests:
#
# $ node tool/server.js
# $ pub run build_runner test -- -P integration
platforms:
- chrome

paths:
- test/xhr_streaming_test.dart

presets:
all:
concurrency: 1
paths:
- test/xhr_streaming_test.dart
- test/sockjs_client_integration_test.dart

integration:
concurrency: 1
paths:
- test/sockjs_client_integration_test.dart

travis:
reporter: expanded
# The SockJS integration test server sometimes gets overloaded and rejects
# connections. Retries are enabled during CI to mitigate these failures.
retry: 3
11 changes: 7 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ authors:
- Sébastien Deleuze
dependencies:
browser: '>=0.9.0 <1.0.0'
dart2_constant: ^1.0.0
logging: '>=0.9.0 <1.0.0'
dev_dependencies:
coverage: ^0.10.0
dart2_constant: ^1.0.1
dart_dev: ^1.9.1
build_runner: ">=0.6.0 <1.0.0"
build_test: ">=0.9.0 <1.0.0"
build_web_compilers: ">=0.2.0 <1.0.0"
coverage: '>=0.10.0 <0.13.0'
dart_dev: ^1.9.5
dart_style: ^1.0.7
test: ^0.12.23+1
environment:
sdk: '>=1.0.0 <2.0.0'
sdk: '>=1.0.0 <3.0.0'

transformers:
- test/pub_serve:
Expand Down
21 changes: 10 additions & 11 deletions tool/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,26 @@ if [ -z "$TASK" ]; then
exit 1
fi

DART_VERSION=$(dart --version 2>&1)
DART_2_PREFIX="Dart VM version: 2"

# Run the correct task type.
case $TASK in
test)
echo -e '\033[1mTASK: Testing [test]\033[22m'

echo -e 'pub build test --web-compiler=dartdevc'
# Precompile tests to avoid timeouts/hung builds.
pub build test --web-compiler=dartdevc
# The --precompile option requires that it be given a merged output dir with
# both compiled JS files and the source .dart files.
# NOTE: Once we're on Dart 2 for good, we can switch to build_runner which
# does all of this for us.
cp -R test/** build/test/

node tool/server.js &
SOCKJS_SERVER=$!

sleep 2

echo -e 'pub run test -j 1 -p chrome --precompiled=build/'
pub run test -j 1 -p chrome --precompiled=build/
if [[ $DART_VERSION = $DART_2_PREFIX* ]]; then
echo -e 'pub run build_runner test -- -P all -P travis'
pub run build_runner test -- -P all -P travis
else
echo -e 'pub run test -P all -P travis'
pub run test -P all -P travis
fi

kill $SOCKJS_SERVER
sleep 2
Expand Down

0 comments on commit fec89b1

Please sign in to comment.