Skip to content

Commit 5e4f4e1

Browse files
authored
Fix the build on latest dev sdks (#3416)
* use TypeError instead of NullThrownError * skip tests checking for no output on stderr until dart-lang/sdk#50592 is resolved * fix serve tests
1 parent 776ea2c commit 5e4f4e1

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

_test/test/common/utils.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Future<void> _startServer(String command, List<String> buildArgs,
6868
}
6969

7070
final proc = _process = await Process.start(command, buildArgs);
71+
unawaited(proc.exitCode.then((_) {
72+
if (_process != null) _process = null;
73+
}));
7174
final stdOutLines = _stdOutLines = proc.stdout
7275
.transform(utf8.decoder)
7376
.transform(const LineSplitter())
@@ -92,8 +95,9 @@ Future<void> stopServer({bool? cleanUp}) async {
9295
final process = _process;
9396
if (process != null) {
9497
expect(process.kill(), true);
95-
await process.exitCode;
98+
var exitCode = process.exitCode;
9699
_process = null;
100+
await exitCode;
97101
}
98102
_stdOutLines = null;
99103

_test/test/help_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ Future<void> _testHelpCommand(List<String> args, {String? checkContent}) async {
5353
var result = await asyncResult;
5454
expect(result.exitCode, equals(0),
5555
reason: 'should give a successful exit code');
56-
expect(result.stderr, isEmpty, reason: 'Should output nothing on stderr');
56+
expect(result.stderr, isEmpty,
57+
reason: 'Should output nothing on stderr',
58+
skip: 'https://github.com/dart-lang/sdk/issues/50592');
5759
expect(result.stdout, isNot(contains('"Unhandled exception"')),
5860
reason: 'Should not print an unhandled exception');
5961
if (checkContent != null) {

_test/test/serve_integration_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ void main() {
7474
var error = nextStdOutLine('Error compiling dartdevc module:'
7575
'_test|test/common/message.sound.ddc.js');
7676
var nextBuild = nextFailedBuild;
77-
await replaceAllInFile(path, "'Hello World!'", '1');
77+
await replaceAllInFile(path, "'Hello World!';", '1;');
7878
await error;
7979
await nextBuild;
8080

8181
nextBuild = nextSuccessfulBuild;
82-
await replaceAllInFile(path, '1', "'Hello World!'");
82+
await replaceAllInFile(path, '1;', "'Hello World!';");
8383
await nextBuild;
8484
await expectTestsPass();
8585
});

build_runner/lib/src/build_script_generate/bootstrap.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Future<int> generateAndRun(
7373
errorPort = ReceivePort();
7474
messagePort = ReceivePort();
7575
errorListener = errorPort.listen((e) {
76-
final error = e[0] as Object? ?? NullThrownError();
76+
final error = e[0] as Object? ?? TypeError();
7777
final trace = Trace.parse(e[1] as String? ?? '').terse;
7878

7979
handleUncaughtError(error, trace);

build_runner/test/build_script_generate/build_script_generate_test.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ builders:
3939
]).create();
4040

4141
var result = await runPub('a', 'run', args: ['build_runner', 'build']);
42-
expect(result.stderr, isEmpty);
42+
expect(result.stderr, isEmpty,
43+
skip: 'https://github.com/dart-lang/sdk/issues/50592');
4344
expect(
4445
result.stdout,
4546
contains(
@@ -58,7 +59,8 @@ builders:
5859
]).create();
5960

6061
var result = await runPub('a', 'run', args: ['build_runner', 'build']);
61-
expect(result.stderr, isEmpty);
62+
expect(result.stderr, isEmpty,
63+
skip: 'https://github.com/dart-lang/sdk/issues/50592');
6264
expect(
6365
result.stdout,
6466
isNot(contains(
@@ -87,7 +89,8 @@ builders:
8789
''')
8890
]).create();
8991
var result = await runPub('a', 'run', args: ['build_runner', 'build']);
90-
expect(result.stderr, isEmpty);
92+
expect(result.stderr, isEmpty,
93+
skip: 'https://github.com/dart-lang/sdk/issues/50592');
9194
expect(result.stdout, contains('could not be parsed'));
9295
});
9396
});
@@ -103,7 +106,8 @@ global_options:
103106
]).create();
104107

105108
var result = await runPub('a', 'run', args: ['build_runner', 'build']);
106-
expect(result.stderr, isEmpty);
109+
expect(result.stderr, isEmpty,
110+
skip: 'https://github.com/dart-lang/sdk/issues/50592');
107111
expect(
108112
result.stdout,
109113
allOf(

0 commit comments

Comments
 (0)