@noego/testing 0.7.3 → 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.cjs +4 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -405,15 +405,6 @@ function createMethodDecorator(registry) {
|
|
|
405
405
|
throw new MethodNotCallableError(tokenLabel(token2), method);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
if (Object.isExtensible(instance)) {
|
|
409
|
-
for (const [method, { entryKey, descriptor }] of effective) {
|
|
410
|
-
const original = instance[method];
|
|
411
|
-
const wrapped = buildMethodWrapper(instance, method, descriptor, registry.state(entryKey, method), original);
|
|
412
|
-
Object.defineProperty(instance, method, { value: wrapped, configurable: true, writable: true, enumerable: false });
|
|
413
|
-
}
|
|
414
|
-
wrappers.set(instance, instance);
|
|
415
|
-
return instance;
|
|
416
|
-
}
|
|
417
408
|
const methodCache = /* @__PURE__ */ new Map();
|
|
418
409
|
const proxy = new Proxy(instance, {
|
|
419
410
|
get(target, prop, receiver) {
|
|
@@ -421,7 +412,7 @@ function createMethodDecorator(registry) {
|
|
|
421
412
|
let wrapped = methodCache.get(prop);
|
|
422
413
|
if (!wrapped) {
|
|
423
414
|
const { entryKey, descriptor } = effective.get(prop);
|
|
424
|
-
wrapped = buildMethodWrapper(target, prop, descriptor, registry.state(entryKey, prop)
|
|
415
|
+
wrapped = buildMethodWrapper(target, prop, descriptor, registry.state(entryKey, prop));
|
|
425
416
|
methodCache.set(prop, wrapped);
|
|
426
417
|
}
|
|
427
418
|
return wrapped;
|
|
@@ -434,9 +425,10 @@ function createMethodDecorator(registry) {
|
|
|
434
425
|
return proxy;
|
|
435
426
|
};
|
|
436
427
|
}
|
|
437
|
-
function buildMethodWrapper(target, method, descriptor, state
|
|
428
|
+
function buildMethodWrapper(target, method, descriptor, state) {
|
|
438
429
|
const callOriginal = (self, args) => {
|
|
439
|
-
|
|
430
|
+
const fn = target[method];
|
|
431
|
+
return fn.apply(self === void 0 ? target : self, args);
|
|
440
432
|
};
|
|
441
433
|
if (typeof descriptor === "function") {
|
|
442
434
|
const replacement = descriptor((...args) => callOriginal(target, args));
|