import {test,expect,vi} from 'vitest';
function val(v){return typeof v==='function'?{type:'function',name:v.name,length:v.length,tag:Object.prototype.toString.call(v),mock:vi.isMockFunction(v)}:v!==null&&typeof v==='object'?{type:'object',tag:Object.prototype.toString.call(v),keys:Reflect.ownKeys(v).map(String)}:{type:typeof v,value:v}}
function shape(v){if(v===null||(typeof v!=='object'&&typeof v!=='function'))return val(v);return {type:typeof v,tag:Object.prototype.toString.call(v),nullPrototype:Object.getPrototypeOf(v)===null,objectPrototype:Object.getPrototypeOf(v)===Object.prototype,functionPrototype:Object.getPrototypeOf(v)===Function.prototype,keys:Reflect.ownKeys(v).map(k=>typeof k==='symbol'?'symbol:'+String(k.description):k),descriptors:Reflect.ownKeys(v).map(k=>{const d=Object.getOwnPropertyDescriptor(v,k);return {key:typeof k==='symbol'?'symbol:'+String(k.description):k,value:val(d.value),get:typeof d.get,set:typeof d.set,writable:d.writable??null,enumerable:d.enumerable,configurable:d.configurable}}),prototype:typeof v==='function'&&Object.hasOwn(v,'prototype')?{keys:Reflect.ownKeys(v.prototype).map(String),descriptors:Reflect.ownKeys(v.prototype).map(k=>{const d=Object.getOwnPropertyDescriptor(v.prototype,k);return {key:String(k),value:val(d.value),get:typeof d.get,set:typeof d.set,writable:d.writable??null,enumerable:d.enumerable,configurable:d.configurable}})}:null}}
function member(v,key){const d=Object.getOwnPropertyDescriptor(v,key);return d?{value:val(d.value),get:typeof d.get,set:typeof d.set,writable:d.writable??null,enumerable:d.enumerable,configurable:d.configurable}:null}
import * as ns0 from './ordinary.cjs';
import * as ns1 from './async.cjs';
import * as ns2 from './generator.cjs';
import * as ns3 from './async-generator.cjs';
test("unmocked ordinary publication namespace",async()=>{const first=ns0;const before={namespace:shape(first),default:shape(first.default),tag:member(first,Symbol.toStringTag)};delete first.default.label;Object.defineProperty(first.default,'method',{enumerable:false});first.default.late='late';const second=await import('./ordinary.cjs');const third=await vi.importActual('./ordinary.cjs');console.log('WS2_CALLABLE_MUTATION:'+JSON.stringify({name:"ordinary",before,after:{namespace:shape(first),default:shape(first.default),dynamicSame:first===second,actualSame:first===third,defaultSame:first.default===second.default,actualDefaultSame:first.default===third.default,namedLabel:val(first.label),namedMethodSame:first.method===first.default.method,lateNamed:val(first.late),tag:member(first,Symbol.toStringTag)}}));expect(first.default).toBe(second.default)});
test("unmocked async publication namespace",async()=>{const first=ns1;const before={namespace:shape(first),default:shape(first.default),tag:member(first,Symbol.toStringTag)};delete first.default.label;Object.defineProperty(first.default,'method',{enumerable:false});first.default.late='late';const second=await import('./async.cjs');const third=await vi.importActual('./async.cjs');console.log('WS2_CALLABLE_MUTATION:'+JSON.stringify({name:"async",before,after:{namespace:shape(first),default:shape(first.default),dynamicSame:first===second,actualSame:first===third,defaultSame:first.default===second.default,actualDefaultSame:first.default===third.default,namedLabel:val(first.label),namedMethodSame:first.method===first.default.method,lateNamed:val(first.late),tag:member(first,Symbol.toStringTag)}}));expect(first.default).toBe(second.default)});
test("unmocked generator publication namespace",async()=>{const first=ns2;const before={namespace:shape(first),default:shape(first.default),tag:member(first,Symbol.toStringTag)};delete first.default.label;Object.defineProperty(first.default,'method',{enumerable:false});first.default.late='late';const second=await import('./generator.cjs');const third=await vi.importActual('./generator.cjs');console.log('WS2_CALLABLE_MUTATION:'+JSON.stringify({name:"generator",before,after:{namespace:shape(first),default:shape(first.default),dynamicSame:first===second,actualSame:first===third,defaultSame:first.default===second.default,actualDefaultSame:first.default===third.default,namedLabel:val(first.label),namedMethodSame:first.method===first.default.method,lateNamed:val(first.late),tag:member(first,Symbol.toStringTag)}}));expect(first.default).toBe(second.default)});
test("unmocked async-generator publication namespace",async()=>{const first=ns3;const before={namespace:shape(first),default:shape(first.default),tag:member(first,Symbol.toStringTag)};delete first.default.label;Object.defineProperty(first.default,'method',{enumerable:false});first.default.late='late';const second=await import('./async-generator.cjs');const third=await vi.importActual('./async-generator.cjs');console.log('WS2_CALLABLE_MUTATION:'+JSON.stringify({name:"async-generator",before,after:{namespace:shape(first),default:shape(first.default),dynamicSame:first===second,actualSame:first===third,defaultSame:first.default===second.default,actualDefaultSame:first.default===third.default,namedLabel:val(first.label),namedMethodSame:first.method===first.default.method,lateNamed:val(first.late),tag:member(first,Symbol.toStringTag)}}));expect(first.default).toBe(second.default)});
