xref: /third_party/node/test/es-module/test-esm-import-meta.mjs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/es-module/
11cb0ef41Sopenharmony_ciimport '../common/index.mjs';
21cb0ef41Sopenharmony_ciimport assert from 'assert';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciassert.strictEqual(Object.getPrototypeOf(import.meta), null);
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst keys = ['resolve', 'url'];
71cb0ef41Sopenharmony_ciassert.deepStrictEqual(Reflect.ownKeys(import.meta), keys);
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst descriptors = Object.getOwnPropertyDescriptors(import.meta);
101cb0ef41Sopenharmony_cifor (const descriptor of Object.values(descriptors)) {
111cb0ef41Sopenharmony_ci  delete descriptor.value; // Values are verified below.
121cb0ef41Sopenharmony_ci  assert.deepStrictEqual(descriptor, {
131cb0ef41Sopenharmony_ci    enumerable: true,
141cb0ef41Sopenharmony_ci    writable: true,
151cb0ef41Sopenharmony_ci    configurable: true
161cb0ef41Sopenharmony_ci  });
171cb0ef41Sopenharmony_ci}
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciconst urlReg = /^file:\/\/\/.*\/test\/es-module\/test-esm-import-meta\.mjs$/;
201cb0ef41Sopenharmony_ciassert(import.meta.url.match(urlReg));
21

Indexes created Thu Nov 07 10:32:03 CST 2024