-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
add retry-ability #128
base: master
Are you sure you want to change the base?
add retry-ability #128
Conversation
exports.matchImageSnapshotPlugin = matchImageSnapshotPlugin; | ||
exports.addMatchImageSnapshotPlugin = addMatchImageSnapshotPlugin; | ||
|
||
var _fsExtra = require('fs-extra'); |
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 not const? also _
means private for me, and this is not a private variable. I would const fsExtra = require('fs-extra');
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.
also, other files in the project use import
syntax. plz support if possible.
ref: https://github.com/palmerhq/cypress-image-snapshot/blob/master/src/plugin.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 not const? also
_
means private for me, and this is not a private variable. I wouldconst fsExtra = require('fs-extra');
this is the same way of coding in the same file
src/command.js
Outdated
@@ -43,6 +43,11 @@ export function matchImageSnapshotCommand(defaultOptions) { | |||
diffOutputPath, | |||
}) => { | |||
if (!pass && !added && !updated) { | |||
if ((commandOptions.retryCounter || 0) > 0) { | |||
cy.wait(100); |
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.
this 100 ms is fine as a default but it should be one of the options and be configurable
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.
done
src/command.js
Outdated
@@ -43,6 +43,11 @@ export function matchImageSnapshotCommand(defaultOptions) { | |||
diffOutputPath, | |||
}) => { | |||
if (!pass && !added && !updated) { | |||
if ((commandOptions.retryCounter || 0) > 0) { |
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.
this can be simplified to
if (commandOptions.retryCounter)
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.
done
command.js
Outdated
diffOutputPath, | ||
}) => { | ||
if (!pass && !added && !updated) { | ||
if ((commandOptions.retryCounter || 0) > 0) { |
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.
u can simply if (commandOptions.retryCounter)
...same comment on configurability of 100 as elsewhere also
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.
done
README.md
Outdated
@@ -161,6 +161,8 @@ or add the following to your `cypress.json` | |||
- `customSnapshotsDir` : Path to the directory that snapshot images will be written to, defaults to `<rootDir>/cypress/snapshots`. | |||
- `customDiffDir`: Path to the directory that diff images will be written to, defaults to a sibling `__diff_output__` directory alongside each snapshot. | |||
|
|||
- `retryCounter` : Retry up to n times before raise a failer and the execution gonna wait for 100 millisecond betwen each iteration. |
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.
slightly better grammar:
Retry up to n times before raising a failure. The process will wait for 100 milliseconds between each iteration.
and, if 100 becomes a configurable default instead of a constant, insert "by default" before final period
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.
done
lgtm |
…duced the official re-try option
…duced the official re-try option
update the cypress-snapshot-plugin fork
|
As a retry-ability is a core function of Cypress, I tried to make it works with minimum changes.