Fix dart2wasm tests with custom HTML files (#2626)
When running tests with `dart2wasm` and a custom HTML file, the JS bootstrap file `run_wasm_chrome.js` failed because it tried to read `dataset` from a DOM element with ID `WasmBootstrapInfo`, which is not present in custom HTML files.
This commit updates `run_wasm_chrome.js` to fallback to inferring the `.wasm` and `.mjs` URLs from `document.currentScript.src` if the `WasmBootstrapInfo` element is not found.
Added a regression test to verify the fix.
Fixes #2625
diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml
index b6b15fd..8143829 100644
--- a/.github/workflows/dart.yml
+++ b/.github/workflows/dart.yml
@@ -315,7 +315,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:integration_tests/regression;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:integration_tests/regression;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:integration_tests/regression
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -352,7 +352,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/checks;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/checks;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/checks
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -389,7 +389,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/matcher;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/matcher;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/matcher
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -426,7 +426,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test_core;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test_core;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test_core
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -493,14 +493,14 @@
- job_005
- job_006
job_012:
- name: "unit_test; linux; Dart 3.10.0; PKG: integration_tests/wasm; `dart test --timeout=60s`"
+ name: "unit_test; linux; Dart 3.10.0; PKG: integration_tests/wasm; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --timeout=60s`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:integration_tests/wasm;commands:test_2"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:integration_tests/wasm;commands:command_00"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:integration_tests/wasm
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -518,8 +518,8 @@
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: integration_tests/wasm
- - name: "integration_tests/wasm; dart test --timeout=60s"
- run: "dart test --timeout=60s"
+ - name: "integration_tests/wasm; xvfb-run -s \"-screen 0 1024x768x24\" dart test --timeout=60s"
+ run: "xvfb-run -s \"-screen 0 1024x768x24\" dart test --timeout=60s"
if: "always() && steps.integration_tests_wasm_pub_upgrade.conclusion == 'success'"
working-directory: integration_tests/wasm
needs:
@@ -537,7 +537,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_01"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_03"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -574,7 +574,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_02"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_04"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -611,7 +611,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_03"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_05"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -648,7 +648,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_04"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_06"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -685,7 +685,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_05"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_07"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -722,7 +722,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test_api;commands:command_11"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test_api;commands:command_13"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test_api
os:ubuntu-latest;pub-cache-hosted;sdk:3.10.0
@@ -759,7 +759,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/regression;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/regression;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/regression
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -796,7 +796,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/checks;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/checks;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/checks
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -833,7 +833,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/matcher;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/matcher;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/matcher
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -870,7 +870,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test_core;commands:command_00"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test_core;commands:command_02"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test_core
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -937,14 +937,14 @@
- job_005
- job_006
job_024:
- name: "unit_test; linux; Dart dev; PKG: integration_tests/wasm; `dart test --timeout=60s`"
+ name: "unit_test; linux; Dart dev; PKG: integration_tests/wasm; `xvfb-run -s \"-screen 0 1024x768x24\" dart test --timeout=60s`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/wasm;commands:test_2"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/wasm;commands:command_00"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_tests/wasm
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -962,8 +962,8 @@
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: integration_tests/wasm
- - name: "integration_tests/wasm; dart test --timeout=60s"
- run: "dart test --timeout=60s"
+ - name: "integration_tests/wasm; xvfb-run -s \"-screen 0 1024x768x24\" dart test --timeout=60s"
+ run: "xvfb-run -s \"-screen 0 1024x768x24\" dart test --timeout=60s"
if: "always() && steps.integration_tests_wasm_pub_upgrade.conclusion == 'success'"
working-directory: integration_tests/wasm
needs:
@@ -981,7 +981,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_01"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_03"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -1018,7 +1018,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_02"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_04"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -1055,7 +1055,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_03"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_05"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -1092,7 +1092,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_04"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_06"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -1129,7 +1129,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_05"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test;commands:command_07"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -1166,7 +1166,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test_api;commands:command_11"
+ key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test_api;commands:command_13"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/test_api
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -1203,7 +1203,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_06"
+ key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_08"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:macos-latest;pub-cache-hosted;sdk:3.10.0
@@ -1240,7 +1240,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_07"
+ key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_09"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:macos-latest;pub-cache-hosted;sdk:3.10.0
@@ -1277,7 +1277,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_08"
+ key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_10"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:macos-latest;pub-cache-hosted;sdk:3.10.0
@@ -1314,7 +1314,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_09"
+ key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_11"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:macos-latest;pub-cache-hosted;sdk:3.10.0
@@ -1351,7 +1351,7 @@
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: "~/.pub-cache/hosted"
- key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_10"
+ key: "os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test;commands:command_12"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:3.10.0;packages:pkgs/test
os:macos-latest;pub-cache-hosted;sdk:3.10.0
diff --git a/integration_tests/wasm/mono_pkg.yaml b/integration_tests/wasm/mono_pkg.yaml
index a8f3410..1b72742 100644
--- a/integration_tests/wasm/mono_pkg.yaml
+++ b/integration_tests/wasm/mono_pkg.yaml
@@ -15,4 +15,9 @@
- analyze: --fatal-infos
- unit_test:
# The config here is a regression test for https://github.com/dart-lang/test/issues/2006
- - test: --timeout=60s
+ - command: xvfb-run -s "-screen 0 1024x768x24" dart test --timeout=60s
+ os:
+ - linux
+ - command: dart test --timeout=60s
+ os:
+ - windows
diff --git a/integration_tests/wasm/test/custom_html_wasm_test.dart b/integration_tests/wasm/test/custom_html_wasm_test.dart
new file mode 100644
index 0000000..e8aedc5
--- /dev/null
+++ b/integration_tests/wasm/test/custom_html_wasm_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
+// 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.
+@TestOn('browser && dart2wasm')
+library;
+
+import 'package:test/test.dart';
+
+void main() {
+ test('success', () {
+ expect(true, isTrue);
+ });
+}
diff --git a/integration_tests/wasm/test/custom_html_wasm_test.html b/integration_tests/wasm/test/custom_html_wasm_test.html
new file mode 100644
index 0000000..2848c41
--- /dev/null
+++ b/integration_tests/wasm/test/custom_html_wasm_test.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="x-dart-test" href="custom_html_wasm_test.dart">
+</head>
+<body>
+ <script src="packages/test/dart.js"></script>
+</body>
+</html>
diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md
index 8246b5e..1aa6bad 100644
--- a/pkgs/test/CHANGELOG.md
+++ b/pkgs/test/CHANGELOG.md
@@ -3,6 +3,8 @@
* Ignore an error locating the SDK directory on platforms where the
`resolvedExecutable` is unexpectedly `null`.
* Fix a bug where `-c exe` tests would hang on exit on windows.
+* Fix a bug where the web test runner would not find custom HTML files when
+ using the dart2wasm compiler.
* `GithubReporter`:
* Group contiguous passing and skipped tests into collapsible groups to
reduce log noise in GitHub Actions.
diff --git a/pkgs/test/lib/src/runner/browser/static/run_wasm_chrome.js b/pkgs/test/lib/src/runner/browser/static/run_wasm_chrome.js
index 6e3bda0..4dabc32 100644
--- a/pkgs/test/lib/src/runner/browser/static/run_wasm_chrome.js
+++ b/pkgs/test/lib/src/runner/browser/static/run_wasm_chrome.js
@@ -7,41 +7,27 @@
// affect chrome.
(async () => {
// Fetch and compile Wasm binary.
- let data = document.getElementById("WasmBootstrapInfo").dataset;
+ let wasmUrl, jsRuntimeUrl;
+ let dataElement = document.getElementById("WasmBootstrapInfo");
+ if (dataElement) {
+ wasmUrl = dataElement.dataset.wasmurl;
+ jsRuntimeUrl = "./" + dataElement.dataset.jsruntimeurl;
+ } else {
+ // Infer from current script
+ let scriptSrc = document.currentScript.src;
+ wasmUrl = scriptSrc.replace(/\.js$/, '.wasm');
+ jsRuntimeUrl = scriptSrc.replace(/\.js$/, '.mjs');
+ }
// Instantiate the Dart module, importing from the global scope.
- let dart2wasmJsRuntime = await import("./" + data.jsruntimeurl);
+ let dart2wasmJsRuntime = await import(jsRuntimeUrl);
- // Support three versions of dart2wasm:
- //
- // (1) Versions before 3.6.0-167.0.dev require the user to compile using the
- // browser's `WebAssembly` API, the compiled module needs to be instantiated
- // using the JS runtime.
- //
- // (2) Versions starting with 3.6.0-167.0.dev added helpers for compiling and
- // instantiating.
- //
- // (3) Versions starting with 3.6.0-212.0.dev made compilation functions
- // return a new type that comes with instantiation and invoke methods.
-
- if (dart2wasmJsRuntime.compileStreaming !== undefined) {
- // Version (2) or (3).
- let compiledModule = await dart2wasmJsRuntime.compileStreaming(
- fetch(data.wasmurl),
- );
- if (compiledModule.instantiate !== undefined) {
- // Version (3).
- let instantiatedModule = await compiledModule.instantiate();
- instantiatedModule.invokeMain();
- } else {
- // Version (2).
- let dartInstance = await dart2wasmJsRuntime.instantiate(compiledModule, {});
- await dart2wasmJsRuntime.invoke(dartInstance);
- }
- } else {
- // Version (1).
- let modulePromise = WebAssembly.compileStreaming(fetch(data.wasmurl));
- let dartInstance = await dart2wasmJsRuntime.instantiate(modulePromise, {});
- await dart2wasmJsRuntime.invoke(dartInstance);
- }
+ // dart2wasm versions starting with 3.6.0-212.0.dev return a new type that
+ // comes with instantiation and invoke methods. Since the min SDK is 3.7,
+ // we only need to support this version.
+ let compiledModule = await dart2wasmJsRuntime.compileStreaming(
+ fetch(wasmUrl),
+ );
+ let instantiatedModule = await compiledModule.instantiate();
+ instantiatedModule.invokeMain();
})();
diff --git a/tool/ci.sh b/tool/ci.sh
index e891be0..fb4c566 100755
--- a/tool/ci.sh
+++ b/tool/ci.sh
@@ -72,50 +72,58 @@
dart analyze || EXIT_CODE=$?
;;
command_00)
+ echo 'xvfb-run -s "-screen 0 1024x768x24" dart test --timeout=60s'
+ xvfb-run -s "-screen 0 1024x768x24" dart test --timeout=60s || EXIT_CODE=$?
+ ;;
+ command_01)
+ echo 'dart test --timeout=60s'
+ dart test --timeout=60s || EXIT_CODE=$?
+ ;;
+ command_02)
echo 'dart test'
dart test || EXIT_CODE=$?
;;
- command_01)
+ command_03)
echo 'xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 0'
xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 0 || EXIT_CODE=$?
;;
- command_02)
+ command_04)
echo 'xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 1'
xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 1 || EXIT_CODE=$?
;;
- command_03)
+ command_05)
echo 'xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 2'
xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 2 || EXIT_CODE=$?
;;
- command_04)
+ command_06)
echo 'xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 3'
xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 3 || EXIT_CODE=$?
;;
- command_05)
+ command_07)
echo 'xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 4'
xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 4 || EXIT_CODE=$?
;;
- command_06)
+ command_08)
echo 'dart test --preset travis --total-shards 5 --shard-index 0'
dart test --preset travis --total-shards 5 --shard-index 0 || EXIT_CODE=$?
;;
- command_07)
+ command_09)
echo 'dart test --preset travis --total-shards 5 --shard-index 1'
dart test --preset travis --total-shards 5 --shard-index 1 || EXIT_CODE=$?
;;
- command_08)
+ command_10)
echo 'dart test --preset travis --total-shards 5 --shard-index 2'
dart test --preset travis --total-shards 5 --shard-index 2 || EXIT_CODE=$?
;;
- command_09)
+ command_11)
echo 'dart test --preset travis --total-shards 5 --shard-index 3'
dart test --preset travis --total-shards 5 --shard-index 3 || EXIT_CODE=$?
;;
- command_10)
+ command_12)
echo 'dart test --preset travis --total-shards 5 --shard-index 4'
dart test --preset travis --total-shards 5 --shard-index 4 || EXIT_CODE=$?
;;
- command_11)
+ command_13)
echo 'dart test --preset travis -x browser -c kernel,exe'
dart test --preset travis -x browser -c kernel,exe || EXIT_CODE=$?
;;
@@ -127,10 +135,6 @@
echo 'dart test -p chrome,vm,node'
dart test -p chrome,vm,node || EXIT_CODE=$?
;;
- test_2)
- echo 'dart test --timeout=60s'
- dart test --timeout=60s || EXIT_CODE=$?
- ;;
*)
echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m"
exit 64