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

Commit 52b3ab5

Browse files
committed
docs(scripts): notes on karma sharding
1 parent f14cc71 commit 52b3ab5

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
@@ -132,6 +132,20 @@ void afterEach(Function fn) {
132132
}
133133

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

0 commit comments

Comments
 (0)