summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/microtasks/with-import-assertions.any.js
blob: f67ba9a1ae4fcedba1a7254c7b930e93d1ac66c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// META: global=window,dedicatedworker,sharedworker
// META: script=ticker.js

promise_test(async t => {
  // Use Date.now() to ensure that the module is not in the module map
  const specifier = "./empty-module.js?" + Date.now();

  const getCount = ticker(1000);

  const importP = import(specifier, { assert: { type: "<invalid>" } });
  await promise_rejects_js(t, TypeError, importP, 'import() should reject');

  assert_less_than(getCount(), 1000);
}, "import() should not drain the microtask queue if it fails while validating the 'type' assertion");