conflict-first-persists.html (1182B)
1 <!DOCTYPE html> 2 <html> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script type="importmap"> 6 { 7 "imports": { 8 "module-a": "../resources/log.js?pipe=sub&name=ModuleA", 9 "module-b/something": "../resources/log.js?pipe=sub&name=ModuleB" 10 } 11 } 12 </script> 13 <script type="importmap"> 14 { 15 "imports": { 16 "module-a": "../resources/log.js?pipe=sub&name=OtherModuleA", 17 "module-b/": "../resources/log.js?pipe=sub&name=PrefixModuleB", 18 "module-b": "../resources/log.js?pipe=sub&name=OtherModuleB" 19 } 20 } 21 </script> 22 <script> 23 const test_loaded = (specifier, expected_log, description) => { 24 promise_test(async t => { 25 log = []; 26 await import(specifier); 27 assert_array_equals(log, expected_log); 28 }, description); 29 }; 30 31 test_loaded( 32 "module-a", 33 ["log:ModuleA"], 34 "First defined rule persists in case of conflict" 35 ); 36 37 test_loaded( 38 "module-b/something", 39 ["log:ModuleB"], 40 "First defined rule persists in case of conflict - prefixed bare specifiers" 41 ); 42 43 test_loaded( 44 "module-b", 45 ["log:OtherModuleB"], 46 "First defined rule persists in case of conflict - non-prefix bare specifier" 47 ); 48 </script> 49 </html>