Git Product home page Git Product logo

Comments (2)

dylan-conway avatar dylan-conway commented on August 20, 2024

Hmm, I appear to get the same results for bun and jest.
bun:

334 |     expect(freeTime).toEqual(expected);
                           ^
error: expect(received).toEqual(expected)

  [
    [
      {
        end: "2024-06-12T09:00:00+02:00",
        start: "2024-06-12T00:00:00+02:00",
      },
      {
        end: "2024-06-12T14:00:00+02:00",
        start: "2024-06-12T12:30:00+02:00",
      },
      {
-       end: "2024-06-12T16:55:00+02:00",
-       start: "2024-06-12T14:30:00+02:00",
-     },
-     {
        end: "2024-06-13T00:00:00+02:00",
+       start: "2024-06-11T18:00:00+02:00",
-       start: "2024-06-12T17:00:00+02:00",
      }
    ],
    [
      {
        end: "2024-06-12T09:00:00+02:00",
        start: "2024-06-12T00:00:00+02:00",
      },
      {
        end: "2024-06-12T14:00:00+02:00",
        start: "2024-06-12T12:30:00+02:00",
      },
      {
-       end: "2024-06-12T17:00:00+02:00",
-       start: "2024-06-12T14:30:00+02:00",
-     },
-     {
        end: "2024-06-13T00:00:00+02:00",
+       start: "2024-06-11T17:15:00+02:00",
-       start: "2024-06-12T17:15:00+02:00",
      }
    ]
  ]

- Expected  - 10
+ Received  + 2

      at /Users/dylan/code/bun/jest-test/j.test.js:334:22
✗ Calculate free time > should calculate free time [13.56ms]

jest:

● Calculate free time › should calculate free time

    expect(received).toEqual(expected) // deep equality

    - Expected  - 10
    + Received  +  2

    @@ -7,32 +7,24 @@
          Object {
            "end": "2024-06-12T14:00:00+02:00",
            "start": "2024-06-12T12:30:00+02:00",
          },
          Object {
    -       "end": "2024-06-12T16:55:00+02:00",
    -       "start": "2024-06-12T14:30:00+02:00",
    -     },
    -     Object {
            "end": "2024-06-13T00:00:00+02:00",
    -       "start": "2024-06-12T17:00:00+02:00",
    +       "start": "2024-06-11T17:00:00+02:00",
          },
        ],
        Array [
          Object {
            "end": "2024-06-12T09:00:00+02:00",
            "start": "2024-06-12T00:00:00+02:00",
          },
          Object {
            "end": "2024-06-12T14:00:00+02:00",
            "start": "2024-06-12T12:30:00+02:00",
    -     },
    -     Object {
    -       "end": "2024-06-12T17:00:00+02:00",
    -       "start": "2024-06-12T14:30:00+02:00",
          },
          Object {
            "end": "2024-06-13T00:00:00+02:00",
    -       "start": "2024-06-12T17:15:00+02:00",
    +       "start": "2024-06-11T17:15:00+02:00",
          },
        ],
      ]

      332 |     console.log(freeTime[0].length, expected[0].length);
      333 |
    > 334 |     expect(freeTime).toEqual(expected);
          |                      ^
      335 |   });
      336 | });
      337 |

      at Object.toEqual (j.test.js:334:22)

It seems the arrays do not have equal length. The array at index 0 in expected has length 4, but freeTimes as index 0 has length 3. What version of jest are you using?

from bun.

Theoreumont avatar Theoreumont commented on August 20, 2024

I don't have any error related to array length.
I'm currently on the last version of Jest, which is to this day, the 29.7.0

I pasted my code in another project to isolate the problem : https://github.com/Theoreumont/bun-bug-report

from bun.

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.