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.

JSON fixtures format on test run

See original GitHub issue
  • Operating System: Ubuntu 16.04
  • Cypress Version: 1.0.3
  • Browser Version: N/A

Is this a Feature or Bug?

Bug

Current behavior:

Whenever I run a test using a json fixture, the fixture file gets formatted. In my project I format all possible files using prettier. This includes json. The formatting that cypress applies conflicts with prettier. Specifically empty object blocks. ({})

Desired behavior:

Ideal: Format using prettier instead of whatever is used now. Acceptable: Don’t format fixtures.

How to reproduce:

  1. Create a test using a json fixture with the contents formatted by prettier. Example: https://prettier.io/playground/#N4Igxg9gdgLgprEAuEwA6UAEm3mgMwEsBzXJTdKDbAXwBocscR8IIzLttcAjAQwBOZTAEZqmGhhog6ICAAcYhaAGdkoPipjJ8fADYq4sngL5gA1nBgBleWcJRiyGAICuRkABMIYHfsOyAFYqAB4AQqYWVtZ8ALZwADIOcH4GHhCuMPKZAEypASB2AoYCyCDB0DKFAg4wAOqEnjAAFsgAHAAMsoaxhM5uHioOxHpwAIquEPD5HjB8PA1NrUg5si58hHrDAMIQsbF8ZVDQKbKuhgAq82pIumk0NEA
  2. Run the test.
  3. Check the file for format differences.

Test code:

See https://github.com/Graham42/cypress-bug-format-fixures

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Graham42commented, Nov 20, 2017

Thank you!

0reactions
brian-manncommented, Nov 20, 2017

Released in 1.1.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simple json fixtures with test rules and annotations - GitHub
Json -Fixtures is a library to simplify tests. You can define fixtures using json and load inside your tests using annotations.
Read more >
Fixtures (JSON file) for UI Testing - javascript - Stack Overflow
Fixtures (JSON file) for UI Testing ... Has anybody used fixtures (json file) to load the data in postgres database and execute UI...
Read more >
Dynamic Tests From Cypress.io Fixture File - YouTube
This video shows how you can import a JSON fixture file into the Cypress spec and create a separate test for each data...
Read more >
What are Fixtures in Cypress? How to Implement ... - Tools QA
Fixtures enable data-driven automation in Cypress by saving the test data in JSON format · Cypress allows the same test script to run...
Read more >
Dynamic Tests From Cypress Fixture - Gleb Bahmutov
Import a JSON fixture file to create dynamic Cypress tests ... Often, you need to run the same test with different data. For...
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