Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use TypeError instead of NullThrownError #3416

Merged
merged 4 commits into from Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion _test/test/common/utils.dart
Expand Up @@ -68,6 +68,9 @@ Future<void> _startServer(String command, List<String> buildArgs,
}

final proc = _process = await Process.start(command, buildArgs);
unawaited(proc.exitCode.then((_) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this come up? Was there a problem when the process died earlier than expected?

if (_process != null) _process = null;
}));
final stdOutLines = _stdOutLines = proc.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
Expand All @@ -92,8 +95,9 @@ Future<void> stopServer({bool? cleanUp}) async {
final process = _process;
if (process != null) {
expect(process.kill(), true);
await process.exitCode;
var exitCode = process.exitCode;
_process = null;
await exitCode;
}
_stdOutLines = null;

Expand Down
4 changes: 3 additions & 1 deletion _test/test/help_test.dart
Expand Up @@ -53,7 +53,9 @@ Future<void> _testHelpCommand(List<String> args, {String? checkContent}) async {
var result = await asyncResult;
expect(result.exitCode, equals(0),
reason: 'should give a successful exit code');
expect(result.stderr, isEmpty, reason: 'Should output nothing on stderr');
expect(result.stderr, isEmpty,
reason: 'Should output nothing on stderr',
skip: 'https://github.com/dart-lang/sdk/issues/50592');
expect(result.stdout, isNot(contains('"Unhandled exception"')),
reason: 'Should not print an unhandled exception');
if (checkContent != null) {
Expand Down
4 changes: 2 additions & 2 deletions _test/test/serve_integration_test.dart
Expand Up @@ -74,12 +74,12 @@ void main() {
var error = nextStdOutLine('Error compiling dartdevc module:'
'_test|test/common/message.sound.ddc.js');
var nextBuild = nextFailedBuild;
await replaceAllInFile(path, "'Hello World!'", '1');
await replaceAllInFile(path, "'Hello World!';", '1;');
await error;
await nextBuild;

nextBuild = nextSuccessfulBuild;
await replaceAllInFile(path, '1', "'Hello World!'");
await replaceAllInFile(path, '1;', "'Hello World!';");
await nextBuild;
await expectTestsPass();
});
Expand Down
2 changes: 1 addition & 1 deletion build_runner/lib/src/build_script_generate/bootstrap.dart
Expand Up @@ -73,7 +73,7 @@ Future<int> generateAndRun(
errorPort = ReceivePort();
messagePort = ReceivePort();
errorListener = errorPort.listen((e) {
final error = e[0] as Object? ?? NullThrownError();
final error = e[0] as Object? ?? TypeError();
final trace = Trace.parse(e[1] as String? ?? '').terse;

handleUncaughtError(error, trace);
Expand Down
Expand Up @@ -39,7 +39,8 @@ builders:
]).create();

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

var result = await runPub('a', 'run', args: ['build_runner', 'build']);
expect(result.stderr, isEmpty);
expect(result.stderr, isEmpty,
skip: 'https://github.com/dart-lang/sdk/issues/50592');
expect(
result.stdout,
isNot(contains(
Expand Down Expand Up @@ -87,7 +89,8 @@ builders:
''')
]).create();
var result = await runPub('a', 'run', args: ['build_runner', 'build']);
expect(result.stderr, isEmpty);
expect(result.stderr, isEmpty,
skip: 'https://github.com/dart-lang/sdk/issues/50592');
expect(result.stdout, contains('could not be parsed'));
});
});
Expand All @@ -103,7 +106,8 @@ global_options:
]).create();

var result = await runPub('a', 'run', args: ['build_runner', 'build']);
expect(result.stderr, isEmpty);
expect(result.stderr, isEmpty,
skip: 'https://github.com/dart-lang/sdk/issues/50592');
expect(
result.stdout,
allOf(
Expand Down