Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/scripting-1/the-script-element/json-module/parse-error.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset=utf-8>
<title>JSON modules: parse error</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
setup({
allow_uncaught_exception: true,
});
async_test(t => {
window.addEventListener("error", t.step_func_done(e => {
assert_true(e instanceof ErrorEvent, "ErrorEvent");
assert_equals(e.filename, new URL("parse-error.json", location).href);
assert_true(e.error instanceof SyntaxError, "SyntaxError");
}));
});
</script>
<script type="module">
import v from "./parse-error.json" with { type: "json" };
</script>