@noego/testing 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -330,7 +330,6 @@ function recordOutcome(call, outcome, threw) {
330
330
  else call.result = outcome;
331
331
  return outcome;
332
332
  }
333
- var pristineMethods = /* @__PURE__ */ new WeakMap();
334
333
  function createMethodDecorator(registry) {
335
334
  const wrappers = /* @__PURE__ */ new WeakMap();
336
335
  return function decorate(instance, token2) {
@@ -351,18 +350,6 @@ function createMethodDecorator(registry) {
351
350
  throw new MethodNotCallableError(tokenLabel(token2), method);
352
351
  }
353
352
  }
354
- if (Object.isExtensible(instance)) {
355
- const pristine = pristineMethods.get(instance) ?? /* @__PURE__ */ new Map();
356
- pristineMethods.set(instance, pristine);
357
- for (const [method, { entryKey, descriptor }] of effective) {
358
- const original = pristine.get(method) ?? instance[method];
359
- pristine.set(method, original);
360
- const wrapped = buildMethodWrapper(instance, method, descriptor, registry.state(entryKey, method), original);
361
- Object.defineProperty(instance, method, { value: wrapped, configurable: true, writable: true, enumerable: false });
362
- }
363
- wrappers.set(instance, instance);
364
- return instance;
365
- }
366
353
  const methodCache = /* @__PURE__ */ new Map();
367
354
  const proxy = new Proxy(instance, {
368
355
  get(target, prop, receiver) {
@@ -370,7 +357,7 @@ function createMethodDecorator(registry) {
370
357
  let wrapped = methodCache.get(prop);
371
358
  if (!wrapped) {
372
359
  const { entryKey, descriptor } = effective.get(prop);
373
- wrapped = buildMethodWrapper(target, prop, descriptor, registry.state(entryKey, prop), target[prop]);
360
+ wrapped = buildMethodWrapper(target, prop, descriptor, registry.state(entryKey, prop));
374
361
  methodCache.set(prop, wrapped);
375
362
  }
376
363
  return wrapped;
@@ -383,9 +370,10 @@ function createMethodDecorator(registry) {
383
370
  return proxy;
384
371
  };
385
372
  }
386
- function buildMethodWrapper(target, method, descriptor, state, original) {
373
+ function buildMethodWrapper(target, method, descriptor, state) {
387
374
  const callOriginal = (self, args) => {
388
- return original.apply(self === void 0 ? target : self, args);
375
+ const fn = target[method];
376
+ return fn.apply(self === void 0 ? target : self, args);
389
377
  };
390
378
  if (typeof descriptor === "function") {
391
379
  const replacement = descriptor((...args) => callOriginal(target, args));