Skip to content
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

Feature/remove post fix #172

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class Differencify {
}
this.configuration = sanitiseGlobalConfiguration(conf);
this.browser = null;
this.testId = 0;
conf.removePostFix === true ? this.testId = undefined : this.testId = 0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a semicolon

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although you don't need this logic here at all.

}

async launchBrowser(options) {
Expand Down Expand Up @@ -57,7 +57,9 @@ export default class Differencify {
}

init(config) {
this.testId += 1;
if (this.testId !== undefined) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather do this here

this.testId = this.configuration ? undefined : this.testId + 1;

this.testId += 1;
}
const testConfig = sanitiseTestConfiguration(config, this.testId);
if (testConfig.isUpdate) {
logger.warn('Your tests are running on update mode. Test screenshots will be updated');
Expand Down
4 changes: 3 additions & 1 deletion src/sanitiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const sanitiseTestConfiguration = (conf, testId) => {
configuration.testName = configuration.testNameProvided
? conf.testName
: testConfig.testName;
configuration.testId = testId;
if (testId !== undefined) {
configuration.testId = testId;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also add

  configuration.removePostFix = checkProperty(conf, 'removePostFix', 'boolean')
    ? conf.removePostFix
    : globalConfig.saveCurrentImage;

To sanitiseGlobalConfiguration function.
and

removePostFix: false,

to defaultConfigs.js

configuration.isUpdate = (process.env.update && process.env.update === 'true')
? process.env.update
: testConfig.isUpdate;
Expand Down