@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.js
CHANGED
|
@@ -350,15 +350,6 @@ function createMethodDecorator(registry) {
|
|
|
350
350
|
throw new MethodNotCallableError(tokenLabel(token2), method);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
if (Object.isExtensible(instance)) {
|
|
354
|
-
for (const [method, { entryKey, descriptor }] of effective) {
|
|
355
|
-
const original = instance[method];
|
|
356
|
-
const wrapped = buildMethodWrapper(instance, method, descriptor, registry.state(entryKey, method), original);
|
|
357
|
-
Object.defineProperty(instance, method, { value: wrapped, configurable: true, writable: true, enumerable: false });
|
|
358
|
-
}
|
|
359
|
-
wrappers.set(instance, instance);
|
|
360
|
-
return instance;
|
|
361
|
-
}
|
|
362
353
|
const methodCache = /* @__PURE__ */ new Map();
|
|
363
354
|
const proxy = new Proxy(instance, {
|
|
364
355
|
get(target, prop, receiver) {
|
|
@@ -366,7 +357,7 @@ function createMethodDecorator(registry) {
|
|
|
366
357
|
let wrapped = methodCache.get(prop);
|
|
367
358
|
if (!wrapped) {
|
|
368
359
|
const { entryKey, descriptor } = effective.get(prop);
|
|
369
|
-
wrapped = buildMethodWrapper(target, prop, descriptor, registry.state(entryKey, prop)
|
|
360
|
+
wrapped = buildMethodWrapper(target, prop, descriptor, registry.state(entryKey, prop));
|
|
370
361
|
methodCache.set(prop, wrapped);
|
|
371
362
|
}
|
|
372
363
|
return wrapped;
|
|
@@ -379,9 +370,10 @@ function createMethodDecorator(registry) {
|
|
|
379
370
|
return proxy;
|
|
380
371
|
};
|
|
381
372
|
}
|
|
382
|
-
function buildMethodWrapper(target, method, descriptor, state
|
|
373
|
+
function buildMethodWrapper(target, method, descriptor, state) {
|
|
383
374
|
const callOriginal = (self, args) => {
|
|
384
|
-
|
|
375
|
+
const fn = target[method];
|
|
376
|
+
return fn.apply(self === void 0 ? target : self, args);
|
|
385
377
|
};
|
|
386
378
|
if (typeof descriptor === "function") {
|
|
387
379
|
const replacement = descriptor((...args) => callOriginal(target, args));
|