Skip to content

Unit Test snapshots differ on OSX and UnixΒ #2995

Open
@FlorianWerndl

Description

Version

3.1.1

Reproduction link

https://codesandbox.io/s/o77krz5n96
Repo: Repo for reproduction: https://github.com/FlorianWerndl/vue-snapshot

Node and OS info

Node 10.3.0 / Yarn 1.12.3 / MacOS 10.14.1 / Ubuntu 16.04.5

Steps to reproduce

  1. Use Jest as test framework
  2. Create component with subcomponent vue-multiselect https://vue-multiselect.js.org/ like example: https://codesandbox.io/s/o77krz5n96
  3. Run yarn test:unit locally to create snapshot
  4. Run yarn test:unit via Gitlab Pipeline on Ubuntu.

What is expected?

Created snapshots should be matching.

What is actually happening?

Create snapshots differ with whitespace.


Reproduction link is only to show setup because I can't create snapshots within codesandbox.
I am using the component vue-multiselect multiple times within my application, only on time the snapshot differs.

There is a space after function on the server snapshot: limittext="function (t) while locally there is no space limittext="function(t)

FAIL src/components/CiLanguageChooser/__tests__/CiLanguageChooser.test.js
  ● Unit | Component | CiLanguageChooser.vue β€Ί should match the snapshot

    expect(value).toMatchSnapshot()

    Received value does not match stored snapshot "Unit | Component | CiLanguageChooser.vue should match the snapshot 1".

    - Snapshot
      Received

    @@ -11,11  11,11 @@
                <div class="d-flex align-items-center">
                  <label class="form-group__label"></label>
                  <citooltip-stub infoiconcolor="black" direction="down" class="tooltip"></citooltip-stub>
                </div>
                <multiselect-stub name="" selectlabel="Press enter to select" selectgrouplabel="Press enter to select group" selectedlabel="Selected" deselectlabel="Press enter to remove" deselectgrouplabel="Press enter to deselect group" limit="99999" maxheight="300"
    -             limittext="function(t){return"and ".concat(t," more")}" opendirection="" shownooptions="true" shownoresults="true" tabindex="0" value="[object Object]" options="[object Object]" close-on-select="true" hideselected="true"
                  limittext="function (t){return"and ".concat(t," more")}" opendirection="" shownooptions="true" shownoresults="true" tabindex="0" value="[object Object]" options="[object Object]" close-on-select="true" hideselected="true"
                  track-by="code" label="code"></multiselect-stub>
              </div>
            </div>
          </div>
        </div>

      44 |       },
      45 |     })
    > 46 |     expect(wrapper).toMatchSnapshot()
         |                     ^
      47 |   })

Metadata

Assignees

No one assigned

    Labels

    needs team reproWe acknowledged your report and will soon try to reproduce it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions