// Auto-generated by scripts/gen_parity_tests.py from docs/runtime-parity.md.
// Module: node:module
// This file is a byte-for-byte parity test against `node --experimental-strip-types`.
// Edit the TODO lines below to exercise each API; rerun
// `./run_parity_tests.sh --filter test_parity_module` to verify.

import * as module from "node:module";


// ── Module Static Methods/Properties ──
// builtinModules — actual array probe (Array.isArray + length + first 5 sorted)
try {
  console.log("Module.builtinModules isArray:", Array.isArray(module.builtinModules));
  console.log("Module.builtinModules length > 50:", module.builtinModules.length > 50);
  const sorted = module.builtinModules.slice().sort();
  console.log("Module.builtinModules first5 sorted:", sorted.slice(0, 5));
} catch (e) {
  console.log("builtinModules area error:", (e as Error).message);
}
// createRequire — typeof only (mutates require system if invoked)
try {
  console.log("Module.createRequire typeof:", typeof module.createRequire);
} catch (e) {
  console.log("createRequire area error:", (e as Error).message);
}
// findPackageJSON — typeof only (filesystem-dependent)
try {
  console.log("Module.findPackageJSON typeof:", typeof module.findPackageJSON);
} catch (e) {
  console.log("findPackageJSON area error:", (e as Error).message);
}
// findSourceMap — probe with no arg; typeof only
try {
  console.log("Module.findSourceMap typeof:", typeof module.findSourceMap);
} catch (e) {
  console.log("findSourceMap area error:", (e as Error).message);
}
// flushCompileCache — typeof only (mutates runtime state)
try {
  console.log("Module.flushCompileCache typeof:", typeof module.flushCompileCache);
} catch (e) {
  console.log("flushCompileCache area error:", (e as Error).message);
}
// getCompileCacheDir — typeof only
try {
  console.log("Module.getCompileCacheDir typeof:", typeof module.getCompileCacheDir);
} catch (e) {
  console.log("getCompileCacheDir area error:", (e as Error).message);
}
// getSourceMapsSupport — typeof only
try {
  console.log("Module.getSourceMapsSupport typeof:", typeof module.getSourceMapsSupport);
} catch (e) {
  console.log("getSourceMapsSupport area error:", (e as Error).message);
}
// isBuiltin — exercise with fs and a non-builtin
try {
  console.log("Module.isBuiltin fs:", module.isBuiltin("fs"));
  console.log("Module.isBuiltin node:fs:", module.isBuiltin("node:fs"));
  console.log("Module.isBuiltin foo:", module.isBuiltin("foo"));
} catch (e) {
  console.log("isBuiltin area error:", (e as Error).message);
}
// register / registerHooks / runMain / syncBuiltinESMExports — typeof only (mutates runtime)
try {
  console.log("Module.register typeof:", typeof module.register);
  console.log("Module.registerHooks typeof:", typeof module.registerHooks);
  console.log("Module.runMain typeof:", typeof module.runMain);
  console.log("Module.setSourceMapsSupport typeof:", typeof module.setSourceMapsSupport);
  console.log("Module.stripTypeScriptTypes typeof:", typeof module.stripTypeScriptTypes);
  console.log("Module.syncBuiltinESMExports typeof:", typeof module.syncBuiltinESMExports);
} catch (e) {
  console.log("mutator typeof area error:", (e as Error).message);
}
// wrap / wrapper — these are CJS-only and may be undefined under ESM
try {
  console.log("Module.wrap typeof:", typeof module.wrap);
  console.log("Module.wrapper typeof:", typeof module.wrapper);
} catch (e) {
  console.log("wrap/wrapper area error:", (e as Error).message);
}
// constants.compileCacheStatus — probe via typeof
try {
  console.log("Module.constants typeof:", typeof module.constants);
} catch (e) {
  console.log("Module.constants area error:", (e as Error).message);
}

// ── Module Instance Properties/Methods ──
// (Auto-emitted in original skeleton; these access top-level `module` which may not be
// reified under ESM strip-types execution — guard each one.)
try {
  console.log("module typeof:", typeof module);
} catch (e) {
  console.log("module typeof area error:", (e as Error).message);
}
// module.require — typeof only (filesystem-dependent)
try {
  console.log("module.require typeof:", typeof (module as any).require);
} catch (e) {
  console.log("module.require area error:", (e as Error).message);
}

// ── Compile Cache API ──
// enableCompileCache — typeof only (mutates runtime)
try {
  console.log("module.enableCompileCache typeof:", typeof module.enableCompileCache);
} catch (e) {
  console.log("enableCompileCache area error:", (e as Error).message);
}
try {
  console.log("module.getCompileCacheDir typeof2:", typeof module.getCompileCacheDir);
  console.log("module.flushCompileCache typeof2:", typeof module.flushCompileCache);
} catch (e) {
  console.log("compileCache typeof area error:", (e as Error).message);
}
try {
  // constants.compileCacheStatus is an object with {ENABLED, ALREADY_ENABLED, FAILED, DISABLED}
  console.log("compileCacheStatus typeof:", typeof (module as any).constants?.compileCacheStatus);
} catch (e) {
  console.log("compileCacheStatus area error:", (e as Error).message);
}

// ── Class: SourceMap ──
try {
  console.log("module.SourceMap typeof:", typeof module.SourceMap);
} catch (e) {
  console.log("SourceMap typeof area error:", (e as Error).message);
}
// new SourceMap(payload) — exercise with a minimal payload
try {
  const sm = new module.SourceMap({ version: 3, sources: ["a.js"], mappings: "" });
  console.log("SourceMap instance typeof:", typeof sm);
  console.log("SourceMap payload typeof:", typeof sm.payload);
  console.log("SourceMap findEntry typeof:", typeof sm.findEntry);
  console.log("SourceMap findOrigin typeof:", typeof sm.findOrigin);
} catch (e) {
  console.log("SourceMap instance area error:", (e as Error).message);
}

// Coverage: 12 auto-emitted, 24 TODO, 0 skip-listed.
