Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dwds/lib/shared/batched_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:async';
import 'dart:math';

import 'package:async/async.dart';
import 'package:dwds/src/utilities/shared.dart';

Expand Down
11 changes: 5 additions & 6 deletions dwds/test/build/build_script_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import 'test_path_utils.dart';
void main() {
group('Committed file integrity tests', () {
test('injected_client_js.dart is in sync with web/client.dart', () async {
final clientDartString = File(
await dwdsPath('web/client.dart'),
).readAsStringSync().replaceAll('\r\n', '\n');
final clientDartString = File(await dwdsPath('web/client.dart'))
.readAsStringSync()
.replaceAll('\r\n', '\n');
final expectedHash = sha256
.convert(utf8.encode(clientDartString))
.toString();
Expand Down Expand Up @@ -106,9 +106,8 @@ void main() {
final lines = actualClientJs.split('\n');
final expectedSafeDartString = [
for (var i = 0; i < lines.length; i++)
jsonEncode(
i == lines.length - 1 ? lines[i] : '${lines[i]}\n',
).replaceAll(r'$', r'\$'),
jsonEncode(i == lines.length - 1 ? lines[i] : '${lines[i]}\n')
.replaceAll(r'$', r'\$'),
].join('\n');

expect(
Expand Down
1 change: 1 addition & 0 deletions dwds/test/build/test_path_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:isolate';

import 'package:path/path.dart' as p;

/// Returns the path to the `dwds` package root directory.
Expand Down
34 changes: 16 additions & 18 deletions dwds/test/integration/common/chrome_proxy_service_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1678,9 +1678,8 @@ void runTests({
});

test('break on exceptions with setIsolatePauseMode', () async {
final oldPauseMode = (await service.getIsolate(
isolateId!,
)).exceptionPauseMode;
final oldPauseMode = (await service.getIsolate(isolateId!))
.exceptionPauseMode;
await service.setIsolatePauseMode(
isolateId!,
exceptionPauseMode: ExceptionPauseMode.kAll,
Expand Down Expand Up @@ -2015,12 +2014,14 @@ void runTests({
final vm = await service.getVM();
final isolateId = vm.isolates!.first.id!;

final resolvedUris = await service
.lookupResolvedPackageUris(isolateId, [
'package:does/not/exist.dart',
'dart:does_not_exist',
'file:///does_not_exist.dart',
]);
final resolvedUris = await service.lookupResolvedPackageUris(
isolateId,
[
'package:does/not/exist.dart',
'dart:does_not_exist',
'file:///does_not_exist.dart',
],
);
expect(resolvedUris.uris, [null, null, null]);
},
);
Expand Down Expand Up @@ -2516,9 +2517,8 @@ void runTests({
predicate(
(Event event) =>
event.kind == EventKind.kWriteEvent &&
String.fromCharCodes(
base64.decode(event.bytes!),
).contains('hello'),
String.fromCharCodes(base64.decode(event.bytes!))
.contains('hello'),
),
),
);
Expand All @@ -2534,9 +2534,8 @@ void runTests({
predicate(
(Event event) =>
event.kind == EventKind.kWriteEvent &&
String.fromCharCodes(
base64.decode(event.bytes!),
).contains('Error'),
String.fromCharCodes(base64.decode(event.bytes!))
.contains('Error'),
),
),
);
Expand All @@ -2552,9 +2551,8 @@ void runTests({
predicate(
(Event event) =>
event.kind == EventKind.kWriteEvent &&
String.fromCharCodes(
base64.decode(event.bytes!),
).contains('main.dart'),
String.fromCharCodes(base64.decode(event.bytes!))
.contains('main.dart'),
),
),
);
Expand Down
5 changes: 2 additions & 3 deletions dwds/test/integration/common/hot_restart_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,8 @@ void runTests({
final eventsDone = expectLater(
client.onIsolateEvent,
emitsThrough(
_hasKind(
EventKind.kServiceExtensionAdded,
).having((e) => e.extensionRPC, 'service', 'ext.bar'),
_hasKind(EventKind.kServiceExtensionAdded)
.having((e) => e.extensionRPC, 'service', 'ext.bar'),
),
);

Expand Down
10 changes: 4 additions & 6 deletions dwds/test/integration/debug_service_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ void testAll({required TestSdkConfigurationProvider provider}) {

test('Accepts connections with the auth token', () async {
expect(
vmServiceConnectUri(
'${context.debugConnection.uri}/ws',
).then((client) => client.dispose()),
vmServiceConnectUri('${context.debugConnection.uri}/ws')
.then((client) => client.dispose()),
completes,
);
});
Expand All @@ -73,9 +72,8 @@ void testAll({required TestSdkConfigurationProvider provider}) {
// However, once DDS is disconnected, additional clients can connect again.
await fakeDds.dispose();
expect(
vmServiceConnectUri(
'${context.debugConnection.uri}/ws',
).then((client) => client.dispose()),
vmServiceConnectUri('${context.debugConnection.uri}/ws')
.then((client) => client.dispose()),
completes,
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:dwds_test_common/logging.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';

import '../../fixtures/context.dart';
import '../../fixtures/project.dart';
import '../../fixtures/utilities.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ void main() {
Future<void> createTempFixtures() async {
tempFixtures = await Directory.systemTemp.createTemp('dwds_test_fixtures');
await tempFixtures.create();
jsonOriginal = await File(
p.join(fixturesDir, 'main.dart.dill.json'),
).copy(p.join(tempFixtures.path, 'main.dart.dill.json'));
mapOriginal = await File(
p.join(fixturesDir, 'main.dart.dill.map'),
).copy(p.join(tempFixtures.path, 'main.dart.dill.map'));
jsonOriginal = await File(p.join(fixturesDir, 'main.dart.dill.json'))
.copy(p.join(tempFixtures.path, 'main.dart.dill.json'));
mapOriginal = await File(p.join(fixturesDir, 'main.dart.dill.map'))
.copy(p.join(tempFixtures.path, 'main.dart.dill.map'));
}

setUp(() async {
Expand Down Expand Up @@ -112,22 +110,20 @@ void main() {
expect(missingResult, isNull);

// Update fixture.
await File(
p.join(tempFixtures.path, 'main.dart.dill.incremental.json'),
).writeAsString(
(await jsonOriginal.readAsString()).replaceAll(
'web/main.dart.lib.js',
'web/foo.dart.lib.js',
),
);
await File(
p.join(tempFixtures.path, 'main.dart.dill.incremental.map'),
).writeAsString(
(await mapOriginal.readAsString()).replaceAll(
'web/main.dart.lib.js',
'web/foo.dart.lib.js',
),
);
await File(p.join(tempFixtures.path, 'main.dart.dill.incremental.json'))
.writeAsString(
(await jsonOriginal.readAsString()).replaceAll(
'web/main.dart.lib.js',
'web/foo.dart.lib.js',
),
);
await File(p.join(tempFixtures.path, 'main.dart.dill.incremental.map'))
.writeAsString(
(await mapOriginal.readAsString()).replaceAll(
'web/main.dart.lib.js',
'web/foo.dart.lib.js',
),
);

assetReader.updateCaches();

Expand Down
5 changes: 2 additions & 3 deletions dwds/test/integration/sdk_configuration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ void main() {
final workerDir = p.dirname(compilerWorkerPath);

Directory(workerDir).createSync(recursive: true);
File(
defaultSdkConfiguration.compilerWorkerPath!,
).copySync(compilerWorkerPath);
File(defaultSdkConfiguration.compilerWorkerPath!)
.copySync(compilerWorkerPath);

expect(sdkConfiguration.sdkDirectory, equals(sdkDirectory));
expect(sdkConfiguration.sdkSummaryPath, equals(sdkSummaryPath));
Expand Down
11 changes: 5 additions & 6 deletions dwds/tool/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ const packageVersion = '$version';
// 5. Generate injected_client_js.dart
print('Generating injected_client_js.dart...');

final clientDartString = File(
'web/client.dart',
).readAsStringSync().replaceAll('\r\n', '\n');
final clientDartString = File('web/client.dart')
.readAsStringSync()
.replaceAll('\r\n', '\n');
final clientDartHash = sha256
.convert(utf8.encode(clientDartString))
.toString();
Expand All @@ -68,9 +68,8 @@ const packageVersion = '$version';
// sign ($) to avoid Dart interpolation.
final safeDartString = [
for (var i = 0; i < lines.length; i++)
jsonEncode(
i == lines.length - 1 ? lines[i] : '${lines[i]}\n',
).replaceAll(r'$', r'\$'),
jsonEncode(i == lines.length - 1 ? lines[i] : '${lines[i]}\n')
.replaceAll(r'$', r'\$'),
].join('\n');

final injectedClientJsFile = File('lib/src/handlers/injected_client_js.dart');
Expand Down
1 change: 1 addition & 0 deletions dwds/web/run_main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:js_interop';

import 'package:web/web.dart';

// According to the CSP3 spec a nonce must be a valid base64 string.
Expand Down
Loading