summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation.js
blob: 9507b313e671d160bbde602107e1470b5adaa7a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// |reftest| async
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
    Dynamic Import should await for evaluation
esid: sec-finishdynamicimport
info: |
    Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
    
    2. Otherwise,
        a. Assert: completion is a normal completion and completion.[[Value]] is undefined.
        b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier).
        c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed.
flags: [async]
features: [dynamic-import]
---*/

var startTime = Date.now();

import('./await-import-evaluation_FIXTURE.js').then(imported => {
  var endTime = Date.now() - startTime;
  assert(imported.time > 100, `${String(imported.time)} > 100`);
  assert(imported.time <= endTime, `${String(imported.time)} > ${String(endTime)}`);
}).then($DONE, $DONE);