Skip to content

Commit 8fb1455

Browse files
Generator tests: prevent parallel running tests
1 parent 1cf3693 commit 8fb1455

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.gitlab-ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ generator-integ-tests:
8484
# Generator tests
8585
- cd generator
8686
- dart pub get
87-
- dart test
87+
# generator test suites must not run in parallel (see notes on GeneratorTestEnv):
88+
# Set concurrency=1 to run only one test suite (== test file) at a time.
89+
# Set --reporter expanded to print log for every completed test.
90+
- dart test --concurrency=1 --reporter expanded
8891
# ObjectBox tests
8992
- cd ../objectbox_test
9093
- ../install.sh

generator/test/generator_test_env.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ import 'package:test/test.dart';
1313
/// Helps testing the generator by running [EntityResolver] on the given
1414
/// [source] file and feeding the output directly into [CodeBuilder] and running
1515
/// it.
16+
///
17+
/// Warning: tests that use this or otherwise create files in the `lib` folder
18+
/// should not run in parallel as this might break when reading unexpected
19+
/// files from the `lib` folder (see [run] which calls
20+
/// `TestReaderWriter.testing.loadIsolateSources()`). So make sure tests are in
21+
/// the same test suite (`main()` method) and use `dart test --concurrency=1`.
22+
/// See also https://pub.dev/packages/test#test-concurrency.
1623
class GeneratorTestEnv {
1724
final EntityResolver resolver;
1825
final Config config;

0 commit comments

Comments
 (0)