2019-03-19 04:52:02 -07:00
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:grinder/grinder_sdk.dart';
|
|
|
|
import 'package:coverage/coverage.dart';
|
|
|
|
import 'package:path/path.dart';
|
|
|
|
|
|
|
|
Future<void> main(List<String> args) async {
|
|
|
|
// First, generate the build script, see
|
|
|
|
// https://github.com/dart-lang/build/blob/3208cfe94c475ed3e1ec44c227aadaddaeac263d/build_runner/bin/build_runner.dart#L65
|
|
|
|
Pub.run('build_runner', arguments: ['generate-build-script']);
|
|
|
|
|
|
|
|
// Next, run the test script in another dart process that has the vm services
|
|
|
|
// enabled.
|
|
|
|
final tests = join(File.fromUri(Platform.script).parent.path, 'tester.dart');
|
2019-05-23 10:17:47 -07:00
|
|
|
final coverage = await runAndCollect(tests, onExit: true, printOutput: true);
|
2019-03-19 04:52:02 -07:00
|
|
|
|
2019-05-23 10:17:47 -07:00
|
|
|
File('coverage.json').writeAsStringSync(json.encode(coverage));
|
2019-03-19 04:52:02 -07:00
|
|
|
}
|