Git Product home page Git Product logo

Comments (10)

oblador avatar oblador commented on May 9, 2024

I’ll do you one better, add a reference file when there isn’t one when running loki test.

from loki.

geraintf avatar geraintf commented on May 9, 2024

Nice! Sounds good, how would that work with the requireReference flag? I guess it'd have to be either or? I could see use cases where you;d prefer options to do it either way

from loki.

oblador avatar oblador commented on May 9, 2024

On CI or with requireReference it would not update

from loki.

geraintf avatar geraintf commented on May 9, 2024

Yeah that's what I was thinking 👍

from loki.

oblador avatar oblador commented on May 9, 2024

@geraintf Have a look at #96

from loki.

geraintf avatar geraintf commented on May 9, 2024

@oblador Just had a play with it and it all seems to work fine. I just had a few thoughts:

  • I think the docs should be updated to reflect the new behaviour.
  • There's still the chance for someone to accidentally introduce regression by using update.
  • The commands I now use for Loki are kinda unclear in terms of the process of how I use it. If I need to add a new reference image I can run a test or update, but update will also modify existing references, update can also be used to approve changes to files as can the approve command. In my head it makes sense to have commands responsible for a single thing e.g. this is the command you use to add reference images, this is the command you use to test and this is the command you use to approve changes.

from loki.

oblador avatar oblador commented on May 9, 2024

@geraintf There's loki approve to just approve, is that what you're looking for?

from loki.

geraintf avatar geraintf commented on May 9, 2024

@oblador I think your change helps (and removes a potential step from the users workflow). I still think there is a way that a user could unknowingly introduce regression.

  • User adds a new story/component
  • User makes a change to some global styles (which breaks another component)
  • User does loki update to add the new file (they could just do loki test but not necessarily)
  • Loki adds the new reference images and approves broken tests.

This leads to potential regression going into production.

from loki.

oblador avatar oblador commented on May 9, 2024

IDK, this issue applies to jest snapshots too? Also you’d see these files both when committing and making a PR.

What is your proposed alternative workflow?

from loki.

geraintf avatar geraintf commented on May 9, 2024

Yeah, it's one of the downsides of jest, it relies on developers always looking through every failed snapshot (which might not always happen) but I guess the idea should be to make this as difficult as possible to happen.

I guess I imagine it being something like:

  • Use update to add your initial ref images
  • Make some changes and/or add new story
  • Run test
  • Test fails because a) You have a story without a reference image b) A story with a reference image is different
  • You run update - this adds any missing reference images (but test would still fail because of the differences)
  • You then check that changes in reference images are what you expect, if so you approve

At the moment that line between adding images and approving images is blurred with update also doing the job of approve.

from loki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.