-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
review changes #3
review changes #3
Conversation
This reverts commit 0ba8af2. "removed # prefix for private fields"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -29,7 +29,7 @@ class _PercyHandler { | |||
private _framework?: string | |||
) { | |||
this._isAppAutomate = isAppAutomate | |||
if (!_percyAutoCaptureMode || !['click', 'auto', 'screenshot', 'manual', 'testcase'].includes(_percyAutoCaptureMode as string)) { | |||
if (_percyAutoCaptureMode && !_percyAutoCaptureMode || !CAPTURE_MODES.includes(_percyAutoCaptureMode as string)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't the first two conditions always evaluate to false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, its correct, the variable is a string and it is null check, have tested it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the first two conditions are _percyAutoCaptureMode && !_percyAutoCaptureMode
. It's like a & !a
which always evaluates to false. So is that condition even necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does always evaluate to undefined or false
But it is acting a null check for the next expression ->
CAPTURE_MODES.includes(_percyAutoCaptureMode as string)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. It's not. It's evaluating to (a && b) || c
. How is the above condition guaranteeing null check on a?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -1,13 +1,14 @@ | |||
declare namespace WebdriverIO { | |||
import PercyCaptureMap from '../Percy/PercyCaptureMap.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it is not at top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html
namespaces/modules are used to organise code and declarations, import statement outside doesn't make sense and hence the build will fail too if we are to import outside
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any reference in the above link that says imports should be inside namespace declaration. What exact build error does it give if we do the imports outside?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Proposed changes
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers