await-import-evaluation.js (1033B)
1 // |reftest| async 2 // Copyright (C) 2018 Leo Balter. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 description: > 6 Dynamic Import should await for evaluation 7 esid: sec-finishdynamicimport 8 info: | 9 Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) 10 11 2. Otherwise, 12 a. Assert: completion is a normal completion and completion.[[Value]] is undefined. 13 b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). 14 c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. 15 flags: [async] 16 features: [dynamic-import] 17 ---*/ 18 19 var startTime = Date.now(); 20 21 import('./await-import-evaluation_FIXTURE.js').then(imported => { 22 var endTime = Date.now() - startTime; 23 assert(imported.time > 100, `${String(imported.time)} > 100`); 24 assert(imported.time <= endTime, `${String(imported.time)} > ${String(endTime)}`); 25 }).then($DONE, $DONE);