11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_cicommon.expectWarning({ 81cb0ef41Sopenharmony_ci Warning: [ 91cb0ef41Sopenharmony_ci ["Accessing non-existent property 'missingPropB' " + 101cb0ef41Sopenharmony_ci 'of module exports inside circular dependency'], 111cb0ef41Sopenharmony_ci ["Accessing non-existent property 'Symbol(someSymbol)' " + 121cb0ef41Sopenharmony_ci 'of module exports inside circular dependency'], 131cb0ef41Sopenharmony_ci ["Accessing non-existent property 'missingPropModuleExportsB' " + 141cb0ef41Sopenharmony_ci 'of module exports inside circular dependency'], 151cb0ef41Sopenharmony_ci ] 161cb0ef41Sopenharmony_ci}); 171cb0ef41Sopenharmony_ciconst required = require(fixtures.path('cycles', 'warning-a.js')); 181cb0ef41Sopenharmony_ciassert.strictEqual(Object.getPrototypeOf(required), Object.prototype); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciconst requiredWithModuleExportsOverridden = 211cb0ef41Sopenharmony_ci require(fixtures.path('cycles', 'warning-moduleexports-a.js')); 221cb0ef41Sopenharmony_ciassert.strictEqual(Object.getPrototypeOf(requiredWithModuleExportsOverridden), 231cb0ef41Sopenharmony_ci Object.prototype); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci// If module.exports is not a regular object, no warning should be emitted. 261cb0ef41Sopenharmony_ciconst classExport = 271cb0ef41Sopenharmony_ci require(fixtures.path('cycles', 'warning-moduleexports-class-a.js')); 281cb0ef41Sopenharmony_ciassert.strictEqual(Object.getPrototypeOf(classExport).name, 'Parent'); 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci// If module.exports.__esModule is set, no warning should be emitted. 311cb0ef41Sopenharmony_ciconst esmTranspiledExport = 321cb0ef41Sopenharmony_ci require(fixtures.path('cycles', 'warning-esm-transpiled-a.js')); 331cb0ef41Sopenharmony_ciassert.strictEqual(esmTranspiledExport.__esModule, true); 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci// If module.exports.__esModule is being accessed but is not present, e.g. 361cb0ef41Sopenharmony_ci// because only the one of the files is a transpiled ES module, no warning 371cb0ef41Sopenharmony_ci// should be emitted. 381cb0ef41Sopenharmony_ciconst halfTranspiledExport = 391cb0ef41Sopenharmony_ci require(fixtures.path('cycles', 'warning-esm-half-transpiled-a.js')); 401cb0ef41Sopenharmony_ciassert.strictEqual(halfTranspiledExport.__esModule, undefined); 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_ci// No circular check is done to prevent triggering proxy traps, if 431cb0ef41Sopenharmony_ci// module.exports is set to a proxy that contains a `getPrototypeOf` or 441cb0ef41Sopenharmony_ci// `setPrototypeOf` trap. 451cb0ef41Sopenharmony_cirequire(fixtures.path('cycles', 'warning-skip-proxy-traps-a.js')); 46