summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/import/import-attributes
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/import/import-attributes
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/import/import-attributes')
-rw-r--r--js/src/tests/test262/language/import/import-attributes/README.md2
-rw-r--r--js/src/tests/test262/language/import/import-attributes/browser.js0
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-extensibility-array.js23
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-extensibility-object.js23
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-idempotency-indirect_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-idempotency.js22
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-idempotency_FIXTURE.json1
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-invalid.js24
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-invalid_FIXTURE.json3
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-named-bindings.js21
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-named-bindings_FIXTURE.json3
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-array.js50
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-array_FIXTURE.json10
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-boolean.js23
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-boolean_FIXTURE.json1
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-null.js23
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-null_FIXTURE.json1
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-number.js23
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-number_FIXTURE.json1
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-object.js70
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-object_FIXTURE.json10
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-string.js23
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-value-string_FIXTURE.json1
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-via-namespace.js16
-rw-r--r--js/src/tests/test262/language/import/import-attributes/json-via-namespace_FIXTURE.json1
-rw-r--r--js/src/tests/test262/language/import/import-attributes/shell.js0
26 files changed, 382 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/import/import-attributes/README.md b/js/src/tests/test262/language/import/import-attributes/README.md
new file mode 100644
index 0000000000..bf4a0de27f
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/README.md
@@ -0,0 +1,2 @@
+Make sure to keep the tests in this folder aligned
+with the tests in the import-assertions folder.
diff --git a/js/src/tests/test262/language/import/import-attributes/browser.js b/js/src/tests/test262/language/import/import-attributes/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/browser.js
diff --git a/js/src/tests/test262/language/import/import-attributes/json-extensibility-array.js b/js/src/tests/test262/language/import/import-attributes/json-extensibility-array.js
new file mode 100644
index 0000000000..c654861c19
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-extensibility-array.js
@@ -0,0 +1,23 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Creates extensible arrays
+flags: [module]
+includes: [propertyHelper.js]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-array_FIXTURE.json' with { type: 'json' };
+
+value.test262property = 'test262 value';
+
+verifyProperty(value, 'test262property', {
+ value: 'test262 value',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-extensibility-object.js b/js/src/tests/test262/language/import/import-attributes/json-extensibility-object.js
new file mode 100644
index 0000000000..12883345a9
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-extensibility-object.js
@@ -0,0 +1,23 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Creates extensible objects
+flags: [module]
+includes: [propertyHelper.js]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-object_FIXTURE.json' with { type: 'json' };
+
+value.test262property = 'test262 value';
+
+verifyProperty(value, 'test262property', {
+ value: 'test262 value',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-idempotency-indirect_FIXTURE.js b/js/src/tests/test262/language/import/import-attributes/json-idempotency-indirect_FIXTURE.js
new file mode 100644
index 0000000000..638ce0a691
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-idempotency-indirect_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+import value from './json-idempotency_FIXTURE.json' with { type: 'json' };
+
+globalThis.viaSecondModule = value;
diff --git a/js/src/tests/test262/language/import/import-attributes/json-idempotency.js b/js/src/tests/test262/language/import/import-attributes/json-idempotency.js
new file mode 100644
index 0000000000..1cadd19aae
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-idempotency.js
@@ -0,0 +1,22 @@
+// |reftest| skip module async -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: The same object representation is returned to all import sites
+flags: [module, async]
+features: [import-attributes, json-modules, globalThis, dynamic-import]
+---*/
+
+import viaStaticImport1 from './json-idempotency_FIXTURE.json' with { type: 'json' };
+import {default as viaStaticImport2} from './json-idempotency_FIXTURE.json' with { type: 'json' };
+import './json-idempotency-indirect_FIXTURE.js';
+
+assert.sameValue(viaStaticImport1, viaStaticImport2);
+assert.sameValue(globalThis.viaSecondModule, viaStaticImport1);
+
+import('./json-idempotency_FIXTURE.json', { with: { type: 'json' } })
+ .then(function(viaDynamicImport) {
+ assert.sameValue(viaDynamicImport.default, viaStaticImport1);
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-idempotency_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-idempotency_FIXTURE.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-idempotency_FIXTURE.json
@@ -0,0 +1 @@
+{}
diff --git a/js/src/tests/test262/language/import/import-attributes/json-invalid.js b/js/src/tests/test262/language/import/import-attributes/json-invalid.js
new file mode 100644
index 0000000000..4e121f368a
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-invalid.js
@@ -0,0 +1,24 @@
+// |reftest| skip error:SyntaxError module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Does not define
+info: |
+ # 1.4 ParseJSONModule ( source )
+
+ The abstract operation ParseJSONModule takes a single argument source which
+ is a String representing the contents of a module.
+
+ 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+ 2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-attributes, json-modules]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import value from './json-invalid_FIXTURE.json' with { type: 'json' };
diff --git a/js/src/tests/test262/language/import/import-attributes/json-invalid_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-invalid_FIXTURE.json
new file mode 100644
index 0000000000..64809bccc4
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-invalid_FIXTURE.json
@@ -0,0 +1,3 @@
+{
+ notJson: 0
+}
diff --git a/js/src/tests/test262/language/import/import-attributes/json-named-bindings.js b/js/src/tests/test262/language/import/import-attributes/json-named-bindings.js
new file mode 100644
index 0000000000..a45e97ce54
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-named-bindings.js
@@ -0,0 +1,21 @@
+// |reftest| skip error:SyntaxError module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Does not define named bindings
+info: |
+ In the early design of JSON modules, contributors considered allowing the
+ properties of object values in JSON modules to be imported directly by name.
+ This was ultimately rejected, so attempting to import in this way should
+ produce a SyntaxError.
+flags: [module]
+features: [import-attributes, json-modules]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import {name} from './json-named-bindings_FIXTURE.json' with { type: 'json' };
diff --git a/js/src/tests/test262/language/import/import-attributes/json-named-bindings_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-named-bindings_FIXTURE.json
new file mode 100644
index 0000000000..ead2bb7c66
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-named-bindings_FIXTURE.json
@@ -0,0 +1,3 @@
+{
+ "name": 0
+}
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-array.js b/js/src/tests/test262/language/import/import-attributes/json-value-array.js
new file mode 100644
index 0000000000..41fa87ca79
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-array.js
@@ -0,0 +1,50 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of an array
+info: |
+ # 1.4 ParseJSONModule ( source )
+
+ The abstract operation ParseJSONModule takes a single argument source which
+ is a String representing the contents of a module.
+
+ 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+ 2. Return CreateDefaultExportSyntheticModule(json).
+
+ To more fully verify parsing correctness, the source text of the imported
+ module record includes non-printable characters (specifically, all four forms
+ of JSON's so-called "whitespace" token) both before and after the "value."
+flags: [module]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-array_FIXTURE.json' with { type: 'json' };
+
+assert(Array.isArray(value), 'the exported value is an array');
+assert.sameValue(
+ Object.getPrototypeOf(value),
+ Array.prototype,
+ 'the exported value is not a subclass of Array'
+);
+assert.sameValue(Object.getOwnPropertyNames(value).length, 7);
+assert.sameValue(value.length, 6);
+
+assert.sameValue(value[0], -1.2345);
+assert.sameValue(value[1], true);
+assert.sameValue(value[2], 'a string value');
+assert.sameValue(value[3], null);
+
+assert.sameValue(Object.getPrototypeOf(value[4]), Object.prototype);
+assert.sameValue(Object.getOwnPropertyNames(value[4]).length, 0);
+
+assert(Array.isArray(value[5]), 'the fifth element is an array');
+assert.sameValue(
+ Object.getPrototypeOf(value[5]),
+ Array.prototype,
+ 'the fifth element is not a subclass of Array'
+);
+assert.sameValue(Object.getOwnPropertyNames(value[5]).length, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-array_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-value-array_FIXTURE.json
new file mode 100644
index 0000000000..9520048793
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-array_FIXTURE.json
@@ -0,0 +1,10 @@
+
+ [
+ -1234.500e-003,
+ true,
+ "a string value",
+ null,
+ {},
+ []
+]
+
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-boolean.js b/js/src/tests/test262/language/import/import-attributes/json-value-boolean.js
new file mode 100644
index 0000000000..91d62565f2
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-boolean.js
@@ -0,0 +1,23 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of a boolean
+info: |
+ # 1.4 ParseJSONModule ( source )
+
+ The abstract operation ParseJSONModule takes a single argument source which
+ is a String representing the contents of a module.
+
+ 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+ 2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-boolean_FIXTURE.json' with { type: 'json' };
+
+assert.sameValue(value, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-boolean_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-value-boolean_FIXTURE.json
new file mode 100644
index 0000000000..27ba77ddaf
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-boolean_FIXTURE.json
@@ -0,0 +1 @@
+true
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-null.js b/js/src/tests/test262/language/import/import-attributes/json-value-null.js
new file mode 100644
index 0000000000..a1c1ff35f5
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-null.js
@@ -0,0 +1,23 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of null
+info: |
+ # 1.4 ParseJSONModule ( source )
+
+ The abstract operation ParseJSONModule takes a single argument source which
+ is a String representing the contents of a module.
+
+ 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+ 2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-null_FIXTURE.json' with { type: 'json' };
+
+assert.sameValue(value, null);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-null_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-value-null_FIXTURE.json
new file mode 100644
index 0000000000..19765bd501
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-null_FIXTURE.json
@@ -0,0 +1 @@
+null
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-number.js b/js/src/tests/test262/language/import/import-attributes/json-value-number.js
new file mode 100644
index 0000000000..2bd1c60270
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-number.js
@@ -0,0 +1,23 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of a number
+info: |
+ # 1.4 ParseJSONModule ( source )
+
+ The abstract operation ParseJSONModule takes a single argument source which
+ is a String representing the contents of a module.
+
+ 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+ 2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-number_FIXTURE.json' with { type: 'json' };
+
+assert.sameValue(value, -1.2345);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-number_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-value-number_FIXTURE.json
new file mode 100644
index 0000000000..859603baed
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-number_FIXTURE.json
@@ -0,0 +1 @@
+-1234.500e-003
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-object.js b/js/src/tests/test262/language/import/import-attributes/json-value-object.js
new file mode 100644
index 0000000000..6c1b6d36f1
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-object.js
@@ -0,0 +1,70 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of an ordinary object
+info: |
+ # 1.4 ParseJSONModule ( source )
+
+ The abstract operation ParseJSONModule takes a single argument source which
+ is a String representing the contents of a module.
+
+ 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+ 2. Return CreateDefaultExportSyntheticModule(json).
+
+ To more fully verify parsing correctness, the source text of the imported
+ module record includes non-printable characters (specifically, all four forms
+ of JSON's so-called "whitespace" token) both before and after the "value."
+flags: [module]
+includes: [propertyHelper.js]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-object_FIXTURE.json' with { type: 'json' };
+
+assert.sameValue(Object.getPrototypeOf(value), Object.prototype);
+assert.sameValue(Object.getOwnPropertyNames(value).length, 6);
+
+verifyProperty(value, 'number', {
+ value: -1.2345,
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+verifyProperty(value, 'boolean', {
+ value: true,
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+verifyProperty(value, 'string', {
+ value: 'a string value',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+verifyProperty(value, 'null', {
+ value: null,
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.getPrototypeOf(value.object), Object.prototype);
+assert.sameValue(Object.getOwnPropertyNames(value.object).length, 0);
+
+assert(
+ Array.isArray(value.array), 'the value of the "array" property is an array'
+);
+assert.sameValue(
+ Object.getPrototypeOf(value.array),
+ Array.prototype,
+ 'the value of the "array" property is not a subclass of Array'
+);
+assert.sameValue(Object.getOwnPropertyNames(value.array).length, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-object_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-value-object_FIXTURE.json
new file mode 100644
index 0000000000..814ec45e4d
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-object_FIXTURE.json
@@ -0,0 +1,10 @@
+
+ {
+ "number": -1234.500e-003,
+ "boolean": true,
+ "string": "a string value",
+ "null": null,
+ "object": {},
+ "array": []
+}
+
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-string.js b/js/src/tests/test262/language/import/import-attributes/json-value-string.js
new file mode 100644
index 0000000000..4b938405b2
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-string.js
@@ -0,0 +1,23 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: Correctly parses the JSON representation of a string
+info: |
+ # 1.4 ParseJSONModule ( source )
+
+ The abstract operation ParseJSONModule takes a single argument source which
+ is a String representing the contents of a module.
+
+ 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
+ 2. Return CreateDefaultExportSyntheticModule(json).
+flags: [module]
+features: [import-attributes, json-modules]
+---*/
+
+import value from './json-value-string_FIXTURE.json' with { type: 'json' };
+
+assert.sameValue(value, 'a string value');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-value-string_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-value-string_FIXTURE.json
new file mode 100644
index 0000000000..d98e333143
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-value-string_FIXTURE.json
@@ -0,0 +1 @@
+"a string value"
diff --git a/js/src/tests/test262/language/import/import-attributes/json-via-namespace.js b/js/src/tests/test262/language/import/import-attributes/json-via-namespace.js
new file mode 100644
index 0000000000..a115b30412
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-via-namespace.js
@@ -0,0 +1,16 @@
+// |reftest| skip module -- json-modules is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-parse-json-module
+description: May be imported via a module namespace object
+flags: [module]
+features: [import-attributes, json-modules]
+---*/
+
+import * as ns from './json-via-namespace_FIXTURE.json' with { type: 'json' };
+
+assert.sameValue(Object.getOwnPropertyNames(ns).length, 1);
+assert.sameValue(ns.default, 262);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/import/import-attributes/json-via-namespace_FIXTURE.json b/js/src/tests/test262/language/import/import-attributes/json-via-namespace_FIXTURE.json
new file mode 100644
index 0000000000..5484d82917
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/json-via-namespace_FIXTURE.json
@@ -0,0 +1 @@
+262
diff --git a/js/src/tests/test262/language/import/import-attributes/shell.js b/js/src/tests/test262/language/import/import-attributes/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/import/import-attributes/shell.js