Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch stack-utils@2.0.5 for the project I'm working on.
Assignments to res.constructor trip over the JavaScript property override mistake, causing Ava test assertion failure results in some environments to become unable to be output. The problem can be reproduced if you freeze Object.prototype.
Here is the diff that solved my problem:
diff --git a/node_modules/stack-utils/index.js b/node_modules/stack-utils/index.js
index ed14bd3..ad9eeb1 100644
--- a/node_modules/stack-utils/index.js
+++ b/node_modules/stack-utils/index.js
@@ -161,7 +161,7 @@ class StackUtils {
setFile(res, site.getFileName(), this._cwd);
if (site.isConstructor()) {
- res.constructor = true;
+ Object.defineProperty(res, 'constructor', { value: true });
}
if (site.isEval()) {
@@ -260,7 +260,7 @@ class StackUtils {
setFile(res, file, this._cwd);
if (ctor) {
- res.constructor = true;
+ Object.defineProperty(res, 'constructor', { value: true });
}
if (evalOrigin) {
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
stack-utils@2.0.5
for the project I'm working on.Assignments to
res.constructor
trip over the JavaScript property override mistake, causing Ava test assertion failure results in some environments to become unable to be output. The problem can be reproduced if you freezeObject.prototype
.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.