Skip to content

Commit

Permalink
[test] Require Dart 3.3, drop dependency on pkg:js
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Feb 20, 2024
1 parent a3f05ec commit 487a004
Show file tree
Hide file tree
Showing 15 changed files with 1,402 additions and 3,260 deletions.
124 changes: 62 additions & 62 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkgs/test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.25.3-wip

* Require Dart 3.3

## 1.25.2

* Fix a bug running browser tests with paths containing windows directory
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test/lib/src/runner/browser/compilers/dart2js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ class Dart2JsSupport extends CompilerSupport with JsHtmlWrapper {
var jsPath = p.join(dir, '${p.basename(dartPath)}.browser_test.dart.js');
var bootstrapContent = '''
${suiteConfig.metadata.languageVersionComment ?? await rootPackageLanguageVersionComment}
import 'dart:js_interop';
import 'package:test/src/bootstrap/browser.dart';
import 'package:test/src/runner/browser/dom.dart' as dom;
import '${await absoluteUri(dartPath)}' as test;
void main() {
dom.window.console.log(r'Startup for test path $dartPath');
dom.window.console.log(r'Startup for test path $dartPath'.toJS);
internalBootstrapBrowserTest(() => test.main);
}
''';
Expand Down
9 changes: 4 additions & 5 deletions pkgs/test/lib/src/runner/browser/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:js_interop';
import 'dart:js_util' as js_util;

import 'package:js/js.dart';

@JS()
@staticInterop
class Window extends EventTarget {}
Expand Down Expand Up @@ -38,8 +37,8 @@ external Window get window;
class Console {}

extension ConsoleExtension on Console {
external void log(Object? object);
external void warn(Object? object);
external void log(JSString object);
external void warn(JSString object);
}

@JS()
Expand Down Expand Up @@ -238,7 +237,7 @@ HTMLIFrameElement createHTMLIFrameElement() =>
class WebSocket extends EventTarget {}

extension WebSocketExtension on WebSocket {
external void send(Object? data);
external void send(JSAny? data);
}

WebSocket createWebSocket(String url) =>
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test/lib/src/runner/browser/post_message_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:js_interop';
import 'dart:js_util';

import 'package:stream_channel/stream_channel.dart';
Expand All @@ -13,7 +14,7 @@ import 'dom.dart' as dom;
///
/// Sends a [MessagePort] to the host page for the channel.
StreamChannel<Object?> postMessageChannel() {
dom.window.console.log('Suite starting, sending channel to host');
dom.window.console.log('Suite starting, sending channel to host'.toJS);
var controller = StreamChannelController<Object?>(sync: true);
var channel = dom.createMessageChannel();
dom.window.parent
Expand Down
Loading

0 comments on commit 487a004

Please sign in to comment.