Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 6c5a161

Browse files
chirayukVictor Savkin
authored and
Victor Savkin
committed
docs(scripts): notes on karma sharding
1 parent 4bca2c6 commit 6c5a161

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

scripts/travis/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ _run_karma_tests() {(
123123
export -f _run_once
124124

125125
if [[ $TESTS == "dart2js" ]]; then
126+
# Ref: test/_specs.dart: _numKarma shards.
126127
# Prime the dart2jsaas cache.
127128
NUM_KARMA_SHARDS=0 BROWSERS=SL_Chrome _run_once 0
128-
129129
# Run sharded karma tests.
130130
export NUM_KARMA_SHARDS=4
131131
seq 0 $((NUM_KARMA_SHARDS-1)) | xargs -n 1 -P $NUM_KARMA_SHARDS -I SHARD_ID \

test/_specs.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,20 @@ void afterEach(Function fn) {
133133
}
134134

135135
// For sharding across multiple instances of karma.
136+
// _numKarmaShards values:
137+
// 1: (default) Use one shard. (i.e. there's no sharding.)
138+
// 0: No shards! So no tests are run. However, the preprocessors are still
139+
// executed and the browsers are launched. This can be used to validate
140+
// the configuration and browsers without running any tests.
141+
// scripts/travis/build.sh uses this to run the preprocessors once to
142+
// generate the dart2js output. It then runs the tests with multiple
143+
// shards knowing that these shards will all use the dart2js output
144+
// generated from the dummy run.
145+
// > 1: Specifies that there are this many number of total karma shards. If
146+
// there are N karma shards and T tests, then each shard runs about T/N
147+
// tests. In this case, the _shardId - which must be [0, N) - indicates
148+
// the current karma shard so we can select the appropriate subset of
149+
// tests to run.
136150
int _numShards = 1;
137151
int _shardId = 0;
138152
int _itCount = 0;

0 commit comments

Comments
 (0)