Debian Codegraph @

js/src/tests/test262/language/import/import-attributes/json-idempotency.js

raw
1 // |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) module async -- requires shell-options
2 // Copyright (C) 2021 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-parse-json-module
6 description: The same object representation is returned to all import sites
7 flags: [module, async]
8 features: [import-attributes, json-modules, globalThis, dynamic-import]
9 ---*/
10
11 import viaStaticImport1 from './json-idempotency_FIXTURE.json' with { type: 'json' };
12 import {default as viaStaticImport2} from './json-idempotency_FIXTURE.json' with { type: 'json' };
13 import './json-idempotency-indirect_FIXTURE.js';
14
15 assert.sameValue(viaStaticImport1, viaStaticImport2);
16 assert.sameValue(globalThis.viaSecondModule, viaStaticImport1);
17
18 import('./json-idempotency_FIXTURE.json', { with: { type: 'json' } })
19 .then(function(viaDynamicImport) {
20 assert.sameValue(viaDynamicImport.default, viaStaticImport1);
21 })
22 .then($DONE, $DONE);