question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid examples in new fixtures files

See original GitHub issue

I am currently going through implementing the new fixtures released as part of 3.9.0 and have encountered an issue with some of the new hidden examples. Take the following from date input:

- name: with values
  hidden: true
  data:
    items:
      -
        id: day
      -
        id: month
      -
        id: year
        value: 2018

This example is missing name and label keys from each item which are marked as required: true in the specification of the component. This is just one instance of this kind of issue, I have encountered several others (Happy to compile a list of all the issues once we’ve bottomed out the discussion…)

I think I would expect all the examples in these files to be valid relative to the specification. It’s causing me a slight issue in govuk-react-jsx whereby my components do not expect these values to be un-set. I had started to embark on making the components more resilient, but thought I would open this ticket before I go too far. I could make my components handle these invalid examples by guarding against these kinds of things, but is that the right thing to do? If people were omitting these attributes whilst actually using my library in the wild, it would be outputting incorrect markup - I actually want my library to throw errors when people do this, not silently swallow them.

Which leads me to think I don’t want to guard against this, and that the base examples should be valid relative to the spec.

What do you think? Perhaps the build tool could even be validating examples against the spec to ensure these don’t get through.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
andymantellcommented, Oct 16, 2020

Hi @vanitabarrett - I’ve noticed a similar / related issue in that some of the fixtures contain lots of references to undefined. For example in the textarea examples you see things like:

"html": "<div class=\"govuk-form-group\">\n  \n\n  \n  \n  <div id=\"undefined-hint\" class=\"govuk-hint\">\n

I think that this is essentially the same issue and would be fixed once all examples contain the required attributes, but I just wanted to flag it for awareness. Don’t know whether you want to track this in a separate ticket

1reaction
andymantellcommented, Sep 22, 2020

Thanks @vanitabarrett. My plan is to try and handle the irregularities but leave comments so I can remove the workarounds again in future, so I’m not blocked. I’ll post a summary of my thoughts once I’ve worked through it all so you can judge whether to take action or not in each case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress generates an invalid config file · Issue #22107 - GitHub
Current behavior Brand new download of Cypress 10.0.2 using esbuild, converting an existing Cypress configuration. This setup did work under ...
Read more >
How to use fixtures — pytest documentation
To do that, pass a callable to scope . The callable must return a string with a valid scope and will be executed...
Read more >
How to use the webtorrent-fixtures.invalid function in webtorrent ...
To help you get started, we've selected a few webtorrent-fixtures.invalid examples, based on popular ... Sample torrent files for the WebTorrent test suite....
Read more >
Django Deserialization Error Problem installing Fixture
Fixtures files must match django serialization format, e.g: [ { "pk": "4b678b301dfd8a4e0dad910de3ae245b", "model": "sessions.session", ...
Read more >
Invalid Input when trying to input Initial Intensity on new light ...
Solved: Hello I am trying to create a light fixture family that has predefined ... like the ones provided by Revit's sample IES...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found