Skip to content

Feat: Ability to remove space before #<attempt> in filename #196

Open
@jestapinski

Description

@jestapinski

I'm looking to use this plugin with a framework (Bazel) that errors should files be passed with spaces in the filename which makes adoption quite complicated. Fortunately, I can provide options to remove most of the default spaces from the Cypress task etc., but this last space is hard coded. (i.e. some task name #0.png (the space before the #0)). This also might be tricky since spaces in filenames in general can be tricky to deal with.

Describe the solution you'd like
A flag perhaps to toggle this space to be on or off (or some other character to be used)

Additional context
Is there some quick workaround?

Activity

added a commit that references this issue on Dec 4, 2022
1e6382f
linked a pull request that will close this issue on Dec 4, 2022
FRSgit

FRSgit commented on Dec 4, 2022

@FRSgit
Member

Hey @jestapinski,

As a temporal workaround please use version 3.2.4-feat-spaces.0 release as a part of PR #199.
Is that change enough for you? If yes, I will wait with it to get other big issues resolved, so there is only a single major version bump (changing filename would be a breaking change).

Also, can you provide me with all of the steps that were necessary to get rid of any spaces from image names? I would like add those to the documentation (maybe in the FAQ section). Of course, feel free to file a PR with that documentation addition by yourself if you want to 🙂

jestapinski

jestapinski commented on Dec 5, 2022

@jestapinski
Author

Hey @FRSgit thanks for the speedy reply!

Looks good to me, see the _ as expected and so that is what I was expecting! To get everything else to omit the space, I passed the following option to matchImage:

{
  title: `${Cypress.currentTest.titlePath.join('_').replace(/\s/g, '_')}`,
}

Alternatively, we could have joined on ' ' since the replace would also catch that. The key is the replace. I can file a PR shortly to add that to the FAQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jestapinski@FRSgit

      Issue actions

        Feat: Ability to remove space before #<attempt> in filename · Issue #196 · FRSOURCE/cypress-plugin-visual-regression-diff