# e is undefined
e?.myObject[X] ?? 0 # return undeifned with optional chaining
# but hammerhead change that into
__get$(e?.myObject, X) ?? 0 # here, an exception is raised.
What is the Expected behavior?
No exception raised.
Here the patch to ugly solve my issue:
diff --git a/node_modules/testcafe-hammerhead/lib/client/hammerhead.js b/node_modules/testcafe-hammerhead/lib/client/hammerhead.js
index 2b7fea5..5e52241 100644
--- a/node_modules/testcafe-hammerhead/lib/client/hammerhead.js
+++ b/node_modules/testcafe-hammerhead/lib/client/hammerhead.js
@@ -4130,6 +4130,7 @@
directive,
extra;
+
var Syntax = {
AssignmentExpression: 'AssignmentExpression',
AssignmentPattern: 'AssignmentPattern',
@@ -21486,7 +21487,9 @@
PropertyAccessorsInstrumentation._propertyGetter = function (owner, propName, optional) {
if (optional === void 0) { optional = false; }
if (isNullOrUndefined(owner) && !optional)
- PropertyAccessorsInstrumentation._error("Cannot read property '".concat(propName, "' of ").concat(inaccessibleTypeToStr(owner)));
+ // ugly fix for https://github.com/DevExpress/testcafe-hammerhead/issues/2858
+ return undefined
+ //PropertyAccessorsInstrumentation._error("Cannot read property '".concat(propName, "' of ").concat(inaccessibleTypeToStr(owner)));
if (typeof propName === 'string' && shouldInstrumentProperty(propName)) {
if (optional && isNullOrUndefined(owner))
return void 0;
What is your public website URL? (or attach your complete example)
What is your Scenario?
Following https://github.com/DevExpress/testcafe-hammerhead/issues/2858, I've got a similar issue.
What is the Current behavior?
What is the Expected behavior?
No exception raised.
Here the patch to ugly solve my issue:
What is your public website URL? (or attach your complete example)
see above
What is your TestCafe test code?
see above
Your complete configuration file
No response
Your complete test report
No response
Screenshots
No response
Steps to Reproduce
see above
TestCafe version
2.5
Node.js version
No response
Command-line arguments
not relevant here
Browser name(s) and version(s)
No response
Platform(s) and version(s)
No response
Other
No response