Initialize dartLoader.rootDirectories so the Web stack trace mapper can convert package source paths (#160383)

See
https://dart.googlesource.com/sdk/+/refs/heads/main/pkg/dev_compiler/web/stack_trace_mapper.dart

Fixes https://github.com/flutter/flutter/issues/158109
This commit is contained in:
Jason Simmons
2025-01-16 16:40:52 -08:00
committed by GitHub
parent a6045c9985
commit 747f5fff1e
4 changed files with 21 additions and 7 deletions

View File

@@ -153,6 +153,18 @@ void main() {
expect(result, contains('''dart_sdk.dart.nativeNonNullAsserts(false);'''));
});
test('generateMainModule sets rootDirectories', () {
const String root = 'http://localhost:12345';
final String result = generateMainModule(
entrypoint: 'foo/bar/main.js',
nullAssertions: false,
nativeNullAssertions: false,
loaderRootDirectory: root,
);
expect(result, contains('''window.\$dartLoader.rootDirectories = ["$root"];'''));
});
test('generateTestBootstrapFileContents embeds urls correctly', () {
final String result = generateTestBootstrapFileContents(
'foo.dart.js',