ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.27k stars 748 forks source link

Tests containing escaped new lines (\n) fail on Windows #7682

Closed CronKz closed 1 week ago

CronKz commented 3 weeks ago

Product

Hot Chocolate

Version

14.0.0

Link to minimal reproduction

See below

Steps to reproduce

  1. Use a Windows machine
  2. Run any Integration Test containing escaped new lines \n
    • Example: HotChocolate.Data.EntitiyFramework.Pagination.Tests
    • Paging_With_PagingFlags_Override

What is expected?

The tests should succeed

What is actually happening?

The tests fail when comparing the diff. Windows uses \r\n instead of \n.

Xunit.Sdk.XunitException The snapshot does not match:

Paging_With_PagingFlags_Override

  {
    "data": {
      "products": {
        "pageCount": 10
      }
    },
    "extensions": {
-     "sql": "-- @__p_0='11'\nSELECT p.\"Id\", p.\"AvailableStock\", p.\"BrandId\", p.\"Description\", p.\"ImageFileName\", p.\"MaxStockThreshold\", p.\"Name\", p.\"OnReorder\", p.\"Price\", p.\"RestockThreshold\", p.\"TypeId\"\nFROM \"Products\" AS p\nORDER BY p.\"Id\"\nLIMIT @__p_0"
+     "sql": "-- @__p_0='11'\r\nSELECT p.\"Id\", p.\"AvailableStock\", p.\"BrandId\", p.\"Description\", p.\"ImageFileName\", p.\"MaxStockThreshold\", p.\"Name\", p.\"OnReorder\", p.\"Price\", p.\"RestockThreshold\", p.\"TypeId\"\r\nFROM \"Products\" AS p\r\nORDER BY p.\"Id\"\r\nLIMIT @__p_0"
    }
  }

Relevant log output

No response

Additional context

I'll submit a possible fix