Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/scripting-1/the-script-element/json-module/non-object.any.html - WPT Dashboard Interop Dashboard
- /html/semantics/scripting-1/the-script-element/json-module/non-object.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /html/semantics/scripting-1/the-script-element/json-module/non-object.any.worker.html - WPT Dashboard Interop Dashboard
// META: global=window,dedicatedworker,sharedworker
for (const value of [null, true, false, "string"]) {
promise_test(async t => {
const result = await import(`./${value}.json`, { with: { type: "json" } });
assert_equals(result.default, value);
}, `Non-object: ${value}`);
}
promise_test(async t => {
const result = await import("./array.json", { with: { type: "json" } });
assert_array_equals(result.default, ["en", "try"]);
}, "Non-object: array");