11cb0ef41Sopenharmony_ciimport '../common/index.mjs';
21cb0ef41Sopenharmony_ciimport assert from 'node:assert/strict';
31cb0ef41Sopenharmony_ciimport { mock } from '../fixtures/es-module-loaders/mock.mjs';
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_cimock('node:events', {
61cb0ef41Sopenharmony_ci  EventEmitter: 'This is mocked!'
71cb0ef41Sopenharmony_ci});
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci// This resolves to node:events
101cb0ef41Sopenharmony_ci// It is intercepted by mock-loader and doesn't return the normal value
111cb0ef41Sopenharmony_ciassert.deepStrictEqual(await import('events'), Object.defineProperty({
121cb0ef41Sopenharmony_ci  __proto__: null,
131cb0ef41Sopenharmony_ci  EventEmitter: 'This is mocked!'
141cb0ef41Sopenharmony_ci}, Symbol.toStringTag, {
151cb0ef41Sopenharmony_ci  enumerable: false,
161cb0ef41Sopenharmony_ci  value: 'Module'
171cb0ef41Sopenharmony_ci}));
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciconst mutator = mock('node:events', {
201cb0ef41Sopenharmony_ci  EventEmitter: 'This is mocked v2!'
211cb0ef41Sopenharmony_ci});
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci// It is intercepted by mock-loader and doesn't return the normal value.
241cb0ef41Sopenharmony_ci// This is resolved separately from the import above since the specifiers
251cb0ef41Sopenharmony_ci// are different.
261cb0ef41Sopenharmony_ciconst mockedV2 = await import('node:events');
271cb0ef41Sopenharmony_ciassert.deepStrictEqual(mockedV2, Object.defineProperty({
281cb0ef41Sopenharmony_ci  __proto__: null,
291cb0ef41Sopenharmony_ci  EventEmitter: 'This is mocked v2!'
301cb0ef41Sopenharmony_ci}, Symbol.toStringTag, {
311cb0ef41Sopenharmony_ci  enumerable: false,
321cb0ef41Sopenharmony_ci  value: 'Module'
331cb0ef41Sopenharmony_ci}));
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_cimutator.EventEmitter = 'This is mocked v3!';
361cb0ef41Sopenharmony_ciassert.deepStrictEqual(mockedV2, Object.defineProperty({
371cb0ef41Sopenharmony_ci  __proto__: null,
381cb0ef41Sopenharmony_ci  EventEmitter: 'This is mocked v3!'
391cb0ef41Sopenharmony_ci}, Symbol.toStringTag, {
401cb0ef41Sopenharmony_ci  enumerable: false,
411cb0ef41Sopenharmony_ci  value: 'Module'
421cb0ef41Sopenharmony_ci}));
43