('$(ContinuousIntegrationBuild)' != 'true' or Exists('/.dockerenv')) and
'$(Scenario)' == 'WasmTestOnBrowser'">true</InstallChromeForTests>
<_XHarnessTestsTimeout>00:30:00</_XHarnessTestsTimeout>
+ <RunWorkingDirectory>$(BundleDir)</RunWorkingDirectory>
</PropertyGroup>
<!-- On CI this is installed as part of pretest, but it should still be installed
<BundleTestWasmAppDependsOn Condition="'$(IsBrowserWasmProject)' == 'true' and '$(BuildAOTTestsOn)' == 'local'">WasmTriggerPublishApp</BundleTestWasmAppDependsOn>
<BundleTestWasmAppDependsOn Condition="'$(IsBrowserWasmProject)' == 'true' and '$(BuildAOTTestsOnHelix)' == 'true'">$(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix</BundleTestWasmAppDependsOn>
- <RunCommand>$(WasmAppHostDir)/WasmAppHost</RunCommand>
<!-- Use BundleDir here, since WasmAppDir is set in a target, and `dotnet run` reads
$(Run*) without running any targets -->
- <RunArguments>--runtime-config $(BundleDir)/WasmTestRunner.runtimeconfig.json $(WasmHostArguments) $(StartArguments) $(WasmXHarnessMonoArgs) $(_AppArgs)</RunArguments>
+ <_RuntimeConfigJsonPath>$([MSBuild]::NormalizePath($(BundleDir), 'WasmTestRunner.runtimeconfig.json'))</_RuntimeConfigJsonPath>
+ <RunArguments>exec "$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))" --runtime-config "$(_RuntimeConfigJsonPath)" $(WasmHostArguments) $(StartArguments) $(WasmXHarnessMonoArgs) $(_AppArgs)</RunArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
/*****************************************************************************
* Please don't use this as template for startup code.
* There are simpler and better samples like src\mono\sample\wasm\browser\main.js
- * This one is not ES6 nor CJS, doesn't use top level await and has edge case polyfills.
+ * This one is not ES6 nor CJS, doesn't use top level await and has edge case polyfills.
* It handles strange things which happen with XHarness.
****************************************************************************/
queryArguments = Array.from(WScript.Arguments);
}
- let runArgs;
- if (queryArguments.length > 0) {
- runArgs = processArguments(queryArguments);
- } else {
- const response = fetch('/runArgs.json')
- if (!response.ok) {
- console.debug(`could not load /args.json: ${response.status}. Ignoring`);
+ let runArgsJson;
+ // ToDo: runArgs should be read for all kinds of hosts, but
+ // fetch is added to node>=18 and current Windows's emcc node<18
+ if (is_browser)
+ {
+ const response = await globalThis.fetch('./runArgs.json');
+ if (response.ok) {
+ runArgsJson = initRunArgs(await response.json());
+ } else {
+ console.debug(`could not load /runArgs.json: ${response.status}. Ignoring`);
}
- runArgs = await response.json();
}
- runArgs = initRunArgs(runArgs);
-
- return runArgs;
+ if (!runArgsJson)
+ runArgsJson = initRunArgs({});
+ return processArguments(queryArguments, runArgsJson);
}
function initRunArgs(runArgs) {
return runArgs;
}
-function processArguments(incomingArguments) {
- const runArgs = initRunArgs({});
-
+function processArguments(incomingArguments, runArgs) {
console.log("Incoming arguments: " + incomingArguments.join(' '));
while (incomingArguments && incomingArguments.length > 0) {
const currentArg = incomingArguments[0];
}
}
-run();
\ No newline at end of file
+run();